aboutsummaryrefslogtreecommitdiff
path: root/libbb/untar.c
diff options
context:
space:
mode:
authorbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-04-12 13:49:09 +0000
committerbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-04-12 13:49:09 +0000
commitc37dede851a87e103cf55c2c6ae7b2731ac10416 (patch)
tree40aecd08a39f0f1ad7074f2a1003ace79bb4c641 /libbb/untar.c
parentf0f9dd4e222e4fc3570eb22d05237a4d600e11d7 (diff)
downloadbusybox-w32-c37dede851a87e103cf55c2c6ae7b2731ac10416.tar.gz
busybox-w32-c37dede851a87e103cf55c2c6ae7b2731ac10416.tar.bz2
busybox-w32-c37dede851a87e103cf55c2c6ae7b2731ac10416.zip
New dpkg-deb function -t, stands for --fsys-tarfile
git-svn-id: svn://busybox.net/trunk/busybox@2333 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb/untar.c')
-rw-r--r--libbb/untar.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/libbb/untar.c b/libbb/untar.c
index 9f7bd303c..11c55df7c 100644
--- a/libbb/untar.c
+++ b/libbb/untar.c
@@ -55,13 +55,26 @@ extern int untar(FILE *src_tar_file, int untar_function, char *base_path)
55 while (fread((char *) &raw_tar_header, 1, 512, src_tar_file) == 512) { 55 while (fread((char *) &raw_tar_header, 1, 512, src_tar_file) == 512) {
56 long sum = 0; 56 long sum = 0;
57 char *dir = NULL; 57 char *dir = NULL;
58
59 if (ferror(src_tar_file) || feof(src_tar_file)) {
60 break;
61 }
58 62
59 uncompressed_count += 512; 63 uncompressed_count += 512;
60 64
61 /* Check header has valid magic */ 65 /* Check header has valid magic */
62 if (strncmp(raw_tar_header.magic, "ustar", 5) != 0) { 66 if (strncmp(raw_tar_header.magic, "ustar", 5) != 0) {
63 /* Put this pack after TODO (check child still alive) is done */ 67/*
64 error_msg("Invalid tar magic"); 68 * FIXME, Need HELP with this
69 *
70 * This has to fail silently or it incorrectly reports errors when called from
71 * deb_extract.
72 * The problem is deb_extract decompresses the .gz file in a child process and
73 * untar reads from the child proccess. The child process finishes and exits,
74 * but fread reads 0's from the src_tar_file even though the child
75 * closed its handle.
76 */
77// error_msg("Invalid tar magic");
65 break; 78 break;
66 } 79 }
67 80
@@ -109,7 +122,7 @@ extern int untar(FILE *src_tar_file, int untar_function, char *base_path)
109 122
110 } 123 }
111*/ 124*/
112 if (untar_function & (extract_verbose_extract | extract_contents)) { 125 if (untar_function & (extract_contents | extract_verbose_extract)) {
113 printf("%s\n", raw_tar_header.name); 126 printf("%s\n", raw_tar_header.name);
114 } 127 }
115 128
@@ -144,7 +157,7 @@ extern int untar(FILE *src_tar_file, int untar_function, char *base_path)
144 break; 157 break;
145 } 158 }
146 case '5': 159 case '5':
147 if (untar_function & (extract_extract | extract_verbose_extract)) { 160 if (untar_function & extract_extract) {
148 if (create_path(dir, mode) != TRUE) { 161 if (create_path(dir, mode) != TRUE) {
149 free(dir); 162 free(dir);
150 perror_msg("%s: Cannot mkdir", raw_tar_header.name); 163 perror_msg("%s: Cannot mkdir", raw_tar_header.name);