wok-4.x view libtar/stuff/libtar-1.2.11.patch @ rev 10042

bison: cross with CONFIGURE_ARGS
author Christophe Lincoln <pankso@slitaz.org>
date Fri May 20 09:00:11 2011 +0200 (2011-05-20)
parents
children
line source
1 diff -Naur libtar-1.2.11-orig/lib/decode.c libtar-1.2.11/lib/decode.c
2 --- libtar-1.2.11-orig/lib/decode.c 2003-01-06 17:40:59.000000000 -0800
3 +++ libtar-1.2.11/lib/decode.c 2004-08-13 12:26:34.000000000 -0700
4 @@ -26,7 +26,7 @@
5 char *
6 th_get_pathname(TAR *t)
7 {
8 - char filename[MAXPATHLEN];
9 + static char filename[MAXPATHLEN];
11 if (t->th_buf.gnu_longname)
12 return t->th_buf.gnu_longname;
13 @@ -35,11 +35,11 @@
14 {
15 snprintf(filename, sizeof(filename), "%.155s/%.100s",
16 t->th_buf.prefix, t->th_buf.name);
17 - return strdup(filename);
18 + return filename;
19 }
21 snprintf(filename, sizeof(filename), "%.100s", t->th_buf.name);
22 - return strdup(filename);
23 + return filename;
24 }
27 diff -Naur libtar-1.2.11-orig/lib/extract.c libtar-1.2.11/lib/extract.c
28 --- libtar-1.2.11-orig/lib/extract.c 2003-03-02 15:58:07.000000000 -0800
29 +++ libtar-1.2.11/lib/extract.c 2004-08-13 12:26:34.000000000 -0700
30 @@ -28,14 +28,6 @@
31 #endif
34 -struct linkname
35 -{
36 - char ln_save[MAXPATHLEN];
37 - char ln_real[MAXPATHLEN];
38 -};
39 -typedef struct linkname linkname_t;
40 -
41 -
42 static int
43 tar_set_file_perms(TAR *t, char *realname)
44 {
45 @@ -98,7 +90,9 @@
46 tar_extract_file(TAR *t, char *realname)
47 {
48 int i;
49 - linkname_t *lnp;
50 + char *lnp;
51 + int pathname_len;
52 + int realname_len;
54 if (t->options & TAR_NOOVERWRITE)
55 {
56 @@ -137,11 +131,13 @@
57 if (i != 0)
58 return i;
60 - lnp = (linkname_t *)calloc(1, sizeof(linkname_t));
61 + pathname_len = strlen(th_get_pathname(t)) + 1;
62 + realname_len = strlen(realname) + 1;
63 + lnp = (char *)calloc(1, pathname_len + realname_len);
64 if (lnp == NULL)
65 return -1;
66 - strlcpy(lnp->ln_save, th_get_pathname(t), sizeof(lnp->ln_save));
67 - strlcpy(lnp->ln_real, realname, sizeof(lnp->ln_real));
68 + strcpy(&lnp[0], th_get_pathname(t));
69 + strcpy(&lnp[pathname_len], realname);
70 #ifdef DEBUG
71 printf("tar_extract_file(): calling libtar_hash_add(): key=\"%s\", "
72 "value=\"%s\"\n", th_get_pathname(t), realname);
73 @@ -288,7 +284,7 @@
74 {
75 char *filename;
76 char *linktgt = NULL;
77 - linkname_t *lnp;
78 + char *lnp;
79 libtar_hashptr_t hp;
81 if (!TH_ISLNK(t))
82 @@ -304,8 +300,8 @@
83 if (libtar_hash_getkey(t->h, &hp, th_get_linkname(t),
84 (libtar_matchfunc_t)libtar_str_match) != 0)
85 {
86 - lnp = (linkname_t *)libtar_hashptr_data(&hp);
87 - linktgt = lnp->ln_real;
88 + lnp = (char *)libtar_hashptr_data(&hp);
89 + linktgt = &lnp[strlen(lnp) + 1];
90 }
91 else
92 linktgt = th_get_linkname(t);
93 diff -Naur libtar-1.2.11-orig/lib/libtar.h libtar-1.2.11/lib/libtar.h
94 --- libtar-1.2.11-orig/lib/libtar.h 2003-01-06 17:40:59.000000000 -0800
95 +++ libtar-1.2.11/lib/libtar.h 2004-08-13 12:26:52.000000000 -0700
96 @@ -63,9 +63,9 @@
97 /***** handle.c ************************************************************/
99 typedef int (*openfunc_t)(const char *, int, ...);
100 -typedef int (*closefunc_t)(int);
101 -typedef ssize_t (*readfunc_t)(int, void *, size_t);
102 -typedef ssize_t (*writefunc_t)(int, const void *, size_t);
103 +typedef int (*closefunc_t)(long);
104 +typedef ssize_t (*readfunc_t)(long, void *, size_t);
105 +typedef ssize_t (*writefunc_t)(long, const void *, size_t);
107 typedef struct
108 {