Fixes from Robert Kaiser
diff --git a/archival/gunzip.c b/archival/gunzip.c
index 0af6adb..93f7c35 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -125,14 +125,13 @@
//static int error_number = 0;
/* ========================================================================
* Signal and error handler.
+ */
static void abort_gzip()
{
error_msg("gzip aborted\n");
-// exit(ERROR);
- return;
+ exit(ERROR);
}
-*/
static void make_crc_table()
{
@@ -918,7 +917,7 @@
in_file = l_in_file;
out_file = l_out_file;
-/* if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
+ if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
(void) signal(SIGINT, (sig_type) abort_gzip);
}
#ifdef SIGTERM
@@ -931,7 +930,7 @@
(void) signal(SIGHUP, (sig_type) abort_gzip);
}
#endif
-*/
+
/* Allocate all global buffers (for DYN_ALLOC option) */
window = xmalloc((size_t)(((2L*WSIZE)+1L)*sizeof(unsigned char)));
outcnt = 0;
@@ -1022,7 +1021,6 @@
{
int unzip_pipe[2];
-// signal(SIGCHLD, abort_gzip);
if (pipe(unzip_pipe)!=0) {
error_msg("pipe error");
return(EXIT_FAILURE);
diff --git a/archival/tar.c b/archival/tar.c
index 9be63ce..fb8d844 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -292,12 +292,13 @@
status = readTarFile(tarFd, extractFlag, listFlag, tostdoutFlag,
verboseFlag, extractList, excludeList);
close(tarFd);
- }
-
#ifdef BB_FEATURE_TAR_GZIP
- gz_close(pid);
- fclose(comp_file);
+ if (unzipFlag == TRUE) {
+ gz_close(pid);
+ fclose(comp_file);
+ }
#endif
+ }
if (status == TRUE)
return EXIT_SUCCESS;
diff --git a/gunzip.c b/gunzip.c
index 0af6adb..93f7c35 100644
--- a/gunzip.c
+++ b/gunzip.c
@@ -125,14 +125,13 @@
//static int error_number = 0;
/* ========================================================================
* Signal and error handler.
+ */
static void abort_gzip()
{
error_msg("gzip aborted\n");
-// exit(ERROR);
- return;
+ exit(ERROR);
}
-*/
static void make_crc_table()
{
@@ -918,7 +917,7 @@
in_file = l_in_file;
out_file = l_out_file;
-/* if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
+ if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
(void) signal(SIGINT, (sig_type) abort_gzip);
}
#ifdef SIGTERM
@@ -931,7 +930,7 @@
(void) signal(SIGHUP, (sig_type) abort_gzip);
}
#endif
-*/
+
/* Allocate all global buffers (for DYN_ALLOC option) */
window = xmalloc((size_t)(((2L*WSIZE)+1L)*sizeof(unsigned char)));
outcnt = 0;
@@ -1022,7 +1021,6 @@
{
int unzip_pipe[2];
-// signal(SIGCHLD, abort_gzip);
if (pipe(unzip_pipe)!=0) {
error_msg("pipe error");
return(EXIT_FAILURE);
diff --git a/tar.c b/tar.c
index 9be63ce..fb8d844 100644
--- a/tar.c
+++ b/tar.c
@@ -292,12 +292,13 @@
status = readTarFile(tarFd, extractFlag, listFlag, tostdoutFlag,
verboseFlag, extractList, excludeList);
close(tarFd);
- }
-
#ifdef BB_FEATURE_TAR_GZIP
- gz_close(pid);
- fclose(comp_file);
+ if (unzipFlag == TRUE) {
+ gz_close(pid);
+ fclose(comp_file);
+ }
#endif
+ }
if (status == TRUE)
return EXIT_SUCCESS;