summaryrefslogtreecommitdiffhomepage
path: root/archival/libunarchive
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2002-11-23 10:44:47 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2002-11-23 10:44:47 +0000
commitb7a76df4d1146940e10fd643828bcc53a824b6aa (patch)
tree1cd0eae04da9abc6431ebda8f300072d7f0f504e /archival/libunarchive
parent1b16bf6b1bd624ef37bb9289cfc9fef266aa1707 (diff)
Fix long filename support
Diffstat (limited to 'archival/libunarchive')
-rw-r--r--archival/libunarchive/get_header_tar.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index d3ff1608a..37e33d4c3 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -20,6 +20,11 @@
#include "unarchive.h"
#include "libbb.h"
+#ifdef CONFIG_FEATURE_GNUTAR_LONG_FILENAME
+static char *longname = NULL;
+static char *linkname = NULL;
+#endif
+
extern char get_header_tar(archive_handle_t *archive_handle)
{
file_header_t *file_header = archive_handle->file_header;
@@ -85,7 +90,16 @@ extern char get_header_tar(archive_handle_t *archive_handle)
return(EXIT_FAILURE);
}
- /* convert to type'ed variables */
+#ifdef CONFIG_FEATURE_GNUTAR_LONG_FILENAME
+ if (longname) {
+ file_header->name = longname;
+ longname = NULL;
+ }
+ else if (linkname) {
+ file_header->name = linkname;
+ linkname = NULL;
+ } else
+#endif
if (tar.formated.prefix[0] == 0) {
file_header->name = strdup(tar.formated.name);
} else {
@@ -134,28 +148,21 @@ extern char get_header_tar(archive_handle_t *archive_handle)
# endif
# ifdef CONFIG_FEATURE_GNUTAR_LONG_FILENAME
case 'L': {
- char *longname;
-
longname = xmalloc(file_header->size + 1);
archive_xread_all(archive_handle, longname, file_header->size);
longname[file_header->size] = '\0';
archive_handle->offset += file_header->size;
- get_header_tar(archive_handle);
- file_header->name = longname;
- break;
+ return(get_header_tar(archive_handle));
}
case 'K': {
- char *linkname;
-
linkname = xmalloc(file_header->size + 1);
archive_xread_all(archive_handle, linkname, file_header->size);
linkname[file_header->size] = '\0';
archive_handle->offset += file_header->size;
- get_header_tar(archive_handle);
file_header->name = linkname;
- break;
+ return(get_header_tar(archive_handle));
}
# endif
}