summaryrefslogtreecommitdiffstats
path: root/libbb
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2010-08-03 20:45:57 (EDT)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2010-08-03 20:45:57 (EDT)
commit97a819864c3f143c4da81e17f32330ba2f1a170c (patch)
treef6b29608c79aae9dd133a3b673bb490ca7b5b9c3 /libbb
parentd8753f35f12f07b795ba06b8a237842727726f63 (diff)
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
Diffstat (limited to 'libbb')
-rw-r--r--libbb/unarchive.c18
1 files changed, 11 insertions, 7 deletions
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':