summaryrefslogtreecommitdiff
path: root/gunzip.c
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2001-03-28 07:27:26 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2001-03-28 07:27:26 +0000
commit018e9e6799ec34d2793c7b16f52e39cd9206861b (patch)
tree6d33d3c39b838f96cd47b0247b1696f9337d87b1 /gunzip.c
parentee79ca1ba69b5b43cd0c2e3b6d2eb20a4a5a0f8e (diff)
downloadbusybox-w32-018e9e6799ec34d2793c7b16f52e39cd9206861b.tar.gz
busybox-w32-018e9e6799ec34d2793c7b16f52e39cd9206861b.tar.bz2
busybox-w32-018e9e6799ec34d2793c7b16f52e39cd9206861b.zip
Fix tar -z, calls gz_open now
Diffstat (limited to 'gunzip.c')
-rw-r--r--gunzip.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gunzip.c b/gunzip.c
index e9f764882..9d81031d7 100644
--- a/gunzip.c
+++ b/gunzip.c
@@ -918,7 +918,7 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
918 in_file = l_in_file; 918 in_file = l_in_file;
919 out_file = l_out_file; 919 out_file = l_out_file;
920 920
921 if (signal(SIGINT, SIG_IGN) != SIG_IGN) { 921/* if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
922 (void) signal(SIGINT, (sig_type) abort_gzip); 922 (void) signal(SIGINT, (sig_type) abort_gzip);
923 } 923 }
924#ifdef SIGTERM 924#ifdef SIGTERM
@@ -931,7 +931,7 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
931 (void) signal(SIGHUP, (sig_type) abort_gzip); 931 (void) signal(SIGHUP, (sig_type) abort_gzip);
932 } 932 }
933#endif 933#endif
934 934*/
935 /* Allocate all global buffers (for DYN_ALLOC option) */ 935 /* Allocate all global buffers (for DYN_ALLOC option) */
936 window = xmalloc((size_t)(((2L*WSIZE)+1L)*sizeof(unsigned char))); 936 window = xmalloc((size_t)(((2L*WSIZE)+1L)*sizeof(unsigned char)));
937 outcnt = 0; 937 outcnt = 0;
@@ -1018,33 +1018,32 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
1018 return 0; 1018 return 0;
1019} 1019}
1020 1020
1021extern FILE *gz_open(FILE *compressed_file, int *pid) 1021extern int gz_open(FILE *compressed_file, int *pid)
1022{ 1022{
1023 int unzip_pipe[2]; 1023 int unzip_pipe[2];
1024 1024
1025 signal(SIGCHLD, abort_gzip); 1025// signal(SIGCHLD, abort_gzip);
1026 if (pipe(unzip_pipe)!=0) { 1026 if (pipe(unzip_pipe)!=0) {
1027 error_msg("pipe error"); 1027 error_msg("pipe error");
1028 return NULL; 1028 return(EXIT_FAILURE);
1029 } 1029 }
1030 if ((*pid = fork()) == -1) { 1030 if ((*pid = fork()) == -1) {
1031 error_msg("fork failured"); 1031 error_msg("fork failured");
1032 return NULL; 1032 return(EXIT_FAILURE);
1033 } 1033 }
1034 if (*pid==0) { 1034 if (*pid==0) {
1035 /* child process */ 1035 /* child process */
1036 close(unzip_pipe[0]); 1036 close(unzip_pipe[0]);
1037 unzip(compressed_file, fdopen(unzip_pipe[1], "w")); 1037 unzip(compressed_file, fdopen(unzip_pipe[1], "w"));
1038// printf("finished unzipping\n"); 1038 printf("finished unzipping\n");
1039 fflush(NULL); 1039 fflush(NULL);
1040// printf("fluched\n");
1041 fclose(compressed_file); 1040 fclose(compressed_file);
1042 close(unzip_pipe[1]); 1041 close(unzip_pipe[1]);
1043 exit(EXIT_SUCCESS); 1042 exit(EXIT_SUCCESS);
1044 } 1043 }
1045 1044
1046 close(unzip_pipe[1]); 1045 close(unzip_pipe[1]);
1047 return (fdopen(unzip_pipe[0], "r")); 1046 return(unzip_pipe[0]);
1048} 1047}
1049 1048
1050extern void gz_close(int gunzip_pid) 1049extern void gz_close(int gunzip_pid)