From: graham.gower Date: Wed, 4 Aug 2010 00:45:57 +0000 (+0000) Subject: Fix creation of symlinks to files with long names (greater than 100 chars). X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=97a819864c3f143c4da81e17f32330ba2f1a170c;p=project%2Fopkg-lede.git Fix creation of symlinks to files with long names (greater than 100 chars). From "paradox.kahn", see Issue #55. git-svn-id: http://opkg.googlecode.com/svn/trunk@544 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- diff --git a/libbb/unarchive.c b/libbb/unarchive.c index bf57a04..b063c63 100644 --- a/libbb/unarchive.c +++ b/libbb/unarchive.c @@ -466,7 +466,7 @@ get_header_tar(FILE *tar_stream) } if (fread(tar.raw, 1, 512, tar_stream) != 512) { - /* Unfortunatly its common for tar files to have all sorts of + /* Unfortunately its common for tar files to have all sorts of * trailing garbage, fail silently */ // error_msg("Couldnt read header"); return(NULL); @@ -505,10 +505,6 @@ get_header_tar(FILE *tar_stream) if (longname) { tar_entry->name = longname; longname = NULL; - } - else if (linkname) { - tar_entry->name = linkname; - linkname = NULL; } else #endif { @@ -534,7 +530,16 @@ get_header_tar(FILE *tar_stream) tar_entry->gid = strtol(tar.formated.gid, NULL, 8); tar_entry->size = strtol(tar.formated.size, NULL, 8); tar_entry->mtime = strtol(tar.formated.mtime, NULL, 8); - tar_entry->link_name = *tar.formated.linkname != '\0' ? xstrndup(tar.formated.linkname, 100) : NULL; +#ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS + if (linkname) { + tar_entry->link_name = linkname; + linkname = NULL; + } else +#endif + { + tar_entry->link_name = *tar.formated.linkname != '\0' ? + xstrndup(tar.formated.linkname, 100) : NULL; + } tar_entry->device = (strtol(tar.formated.devmajor, NULL, 8) << 8) + strtol(tar.formated.devminor, NULL, 8); @@ -586,7 +591,6 @@ get_header_tar(FILE *tar_stream) linkname[tar_entry->size] = '\0'; archive_offset += tar_entry->size; - tar_entry->name = linkname; return(get_header_tar(tar_stream)); } case 'D':