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