summaryrefslogtreecommitdiff
path: root/archival/tar.c
diff options
context:
space:
mode:
authorGlenn L McGrath2001-03-28 07:27:26 +0000
committerGlenn L McGrath2001-03-28 07:27:26 +0000
commit018e9e6799ec34d2793c7b16f52e39cd9206861b (patch)
tree6d33d3c39b838f96cd47b0247b1696f9337d87b1 /archival/tar.c
parentee79ca1ba69b5b43cd0c2e3b6d2eb20a4a5a0f8e (diff)
downloadbusybox-018e9e6799ec34d2793c7b16f52e39cd9206861b.zip
busybox-018e9e6799ec34d2793c7b16f52e39cd9206861b.tar.gz
Fix tar -z, calls gz_open now
Diffstat (limited to 'archival/tar.c')
-rw-r--r--archival/tar.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 16b3fb4..46321de 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -58,6 +58,8 @@
#ifdef BB_FEATURE_TAR_GZIP
extern int unzip(int in, int out);
+extern int gz_open(FILE *compressed_file, int *pid);
+extern void gz_close(int gunzip_pid);
#endif
/* Tar file constants */
@@ -202,6 +204,7 @@ extern int tar_main(int argc, char **argv)
char file[256];
#endif
#if defined BB_FEATURE_TAR_GZIP
+ FILE *comp_file = NULL;
int unzipFlag = FALSE;
#endif
int listFlag = FALSE;
@@ -211,6 +214,7 @@ extern int tar_main(int argc, char **argv)
int tostdoutFlag = FALSE;
int status = FALSE;
int opt;
+ pid_t pid;
if (argc <= 1)
show_usage();
@@ -315,13 +319,25 @@ extern int tar_main(int argc, char **argv)
#ifdef BB_FEATURE_TAR_GZIP
/* unzip tarFd in a seperate process */
- if (unzipFlag == TRUE)
- tarFd = tar_unzip_init(tarFd);
+ if (unzipFlag == TRUE) {
+ comp_file = fdopen(tarFd, "r");
+ printf("1\n");
+ if ((tarFd = gz_open(comp_file, &pid)) == EXIT_FAILURE) {
+ error_msg_and_die("Couldnt unzip file");
+ }
+ printf("2\n");
+ }
#endif
status = readTarFile(tarFd, extractFlag, listFlag, tostdoutFlag,
verboseFlag, extractList, excludeList);
+ close(tarFd);
}
+#ifdef BB_FEATURE_TAR_GZIP
+ gz_close(pid);
+ fclose(comp_file);
+#endif
+
if (status == TRUE)
return EXIT_SUCCESS;
else