wok diff libtar/stuff/libtar-1.2.11.patch @ rev 7727
Up: fsarchiver to 0.6.11. Made it work in clean chroot now too.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Sun Dec 19 18:52:23 2010 +0000 (2010-12-19) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libtar/stuff/libtar-1.2.11.patch Sun Dec 19 18:52:23 2010 +0000 1.3 @@ -0,0 +1,108 @@ 1.4 +diff -Naur libtar-1.2.11-orig/lib/decode.c libtar-1.2.11/lib/decode.c 1.5 +--- libtar-1.2.11-orig/lib/decode.c 2003-01-06 17:40:59.000000000 -0800 1.6 ++++ libtar-1.2.11/lib/decode.c 2004-08-13 12:26:34.000000000 -0700 1.7 +@@ -26,7 +26,7 @@ 1.8 + char * 1.9 + th_get_pathname(TAR *t) 1.10 + { 1.11 +- char filename[MAXPATHLEN]; 1.12 ++ static char filename[MAXPATHLEN]; 1.13 + 1.14 + if (t->th_buf.gnu_longname) 1.15 + return t->th_buf.gnu_longname; 1.16 +@@ -35,11 +35,11 @@ 1.17 + { 1.18 + snprintf(filename, sizeof(filename), "%.155s/%.100s", 1.19 + t->th_buf.prefix, t->th_buf.name); 1.20 +- return strdup(filename); 1.21 ++ return filename; 1.22 + } 1.23 + 1.24 + snprintf(filename, sizeof(filename), "%.100s", t->th_buf.name); 1.25 +- return strdup(filename); 1.26 ++ return filename; 1.27 + } 1.28 + 1.29 + 1.30 +diff -Naur libtar-1.2.11-orig/lib/extract.c libtar-1.2.11/lib/extract.c 1.31 +--- libtar-1.2.11-orig/lib/extract.c 2003-03-02 15:58:07.000000000 -0800 1.32 ++++ libtar-1.2.11/lib/extract.c 2004-08-13 12:26:34.000000000 -0700 1.33 +@@ -28,14 +28,6 @@ 1.34 + #endif 1.35 + 1.36 + 1.37 +-struct linkname 1.38 +-{ 1.39 +- char ln_save[MAXPATHLEN]; 1.40 +- char ln_real[MAXPATHLEN]; 1.41 +-}; 1.42 +-typedef struct linkname linkname_t; 1.43 +- 1.44 +- 1.45 + static int 1.46 + tar_set_file_perms(TAR *t, char *realname) 1.47 + { 1.48 +@@ -98,7 +90,9 @@ 1.49 + tar_extract_file(TAR *t, char *realname) 1.50 + { 1.51 + int i; 1.52 +- linkname_t *lnp; 1.53 ++ char *lnp; 1.54 ++ int pathname_len; 1.55 ++ int realname_len; 1.56 + 1.57 + if (t->options & TAR_NOOVERWRITE) 1.58 + { 1.59 +@@ -137,11 +131,13 @@ 1.60 + if (i != 0) 1.61 + return i; 1.62 + 1.63 +- lnp = (linkname_t *)calloc(1, sizeof(linkname_t)); 1.64 ++ pathname_len = strlen(th_get_pathname(t)) + 1; 1.65 ++ realname_len = strlen(realname) + 1; 1.66 ++ lnp = (char *)calloc(1, pathname_len + realname_len); 1.67 + if (lnp == NULL) 1.68 + return -1; 1.69 +- strlcpy(lnp->ln_save, th_get_pathname(t), sizeof(lnp->ln_save)); 1.70 +- strlcpy(lnp->ln_real, realname, sizeof(lnp->ln_real)); 1.71 ++ strcpy(&lnp[0], th_get_pathname(t)); 1.72 ++ strcpy(&lnp[pathname_len], realname); 1.73 + #ifdef DEBUG 1.74 + printf("tar_extract_file(): calling libtar_hash_add(): key=\"%s\", " 1.75 + "value=\"%s\"\n", th_get_pathname(t), realname); 1.76 +@@ -288,7 +284,7 @@ 1.77 + { 1.78 + char *filename; 1.79 + char *linktgt = NULL; 1.80 +- linkname_t *lnp; 1.81 ++ char *lnp; 1.82 + libtar_hashptr_t hp; 1.83 + 1.84 + if (!TH_ISLNK(t)) 1.85 +@@ -304,8 +300,8 @@ 1.86 + if (libtar_hash_getkey(t->h, &hp, th_get_linkname(t), 1.87 + (libtar_matchfunc_t)libtar_str_match) != 0) 1.88 + { 1.89 +- lnp = (linkname_t *)libtar_hashptr_data(&hp); 1.90 +- linktgt = lnp->ln_real; 1.91 ++ lnp = (char *)libtar_hashptr_data(&hp); 1.92 ++ linktgt = &lnp[strlen(lnp) + 1]; 1.93 + } 1.94 + else 1.95 + linktgt = th_get_linkname(t); 1.96 +diff -Naur libtar-1.2.11-orig/lib/libtar.h libtar-1.2.11/lib/libtar.h 1.97 +--- libtar-1.2.11-orig/lib/libtar.h 2003-01-06 17:40:59.000000000 -0800 1.98 ++++ libtar-1.2.11/lib/libtar.h 2004-08-13 12:26:52.000000000 -0700 1.99 +@@ -63,9 +63,9 @@ 1.100 + /***** handle.c ************************************************************/ 1.101 + 1.102 + typedef int (*openfunc_t)(const char *, int, ...); 1.103 +-typedef int (*closefunc_t)(int); 1.104 +-typedef ssize_t (*readfunc_t)(int, void *, size_t); 1.105 +-typedef ssize_t (*writefunc_t)(int, const void *, size_t); 1.106 ++typedef int (*closefunc_t)(long); 1.107 ++typedef ssize_t (*readfunc_t)(long, void *, size_t); 1.108 ++typedef ssize_t (*writefunc_t)(long, const void *, size_t); 1.109 + 1.110 + typedef struct 1.111 + {