Fixes from Robert Kaiser

This commit is contained in:
Glenn L McGrath 2001-03-28 23:57:51 +00:00
parent e0a7f917c2
commit ae8ad35590
4 changed files with 18 additions and 20 deletions

View File

@ -125,14 +125,13 @@ unsigned short mask_bits[] = {
//static int error_number = 0; //static int error_number = 0;
/* ======================================================================== /* ========================================================================
* Signal and error handler. * Signal and error handler.
*/
static void abort_gzip() static void abort_gzip()
{ {
error_msg("gzip aborted\n"); error_msg("gzip aborted\n");
// exit(ERROR); exit(ERROR);
return;
} }
*/
static void make_crc_table() static void make_crc_table()
{ {
@ -918,7 +917,7 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
in_file = l_in_file; in_file = l_in_file;
out_file = l_out_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); (void) signal(SIGINT, (sig_type) abort_gzip);
} }
#ifdef SIGTERM #ifdef SIGTERM
@ -931,7 +930,7 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
(void) signal(SIGHUP, (sig_type) abort_gzip); (void) signal(SIGHUP, (sig_type) abort_gzip);
} }
#endif #endif
*/
/* Allocate all global buffers (for DYN_ALLOC option) */ /* Allocate all global buffers (for DYN_ALLOC option) */
window = xmalloc((size_t)(((2L*WSIZE)+1L)*sizeof(unsigned char))); window = xmalloc((size_t)(((2L*WSIZE)+1L)*sizeof(unsigned char)));
outcnt = 0; outcnt = 0;
@ -1022,7 +1021,6 @@ extern int gz_open(FILE *compressed_file, int *pid)
{ {
int unzip_pipe[2]; int unzip_pipe[2];
// signal(SIGCHLD, abort_gzip);
if (pipe(unzip_pipe)!=0) { if (pipe(unzip_pipe)!=0) {
error_msg("pipe error"); error_msg("pipe error");
return(EXIT_FAILURE); return(EXIT_FAILURE);

View File

@ -292,12 +292,13 @@ extern int tar_main(int argc, char **argv)
status = readTarFile(tarFd, extractFlag, listFlag, tostdoutFlag, status = readTarFile(tarFd, extractFlag, listFlag, tostdoutFlag,
verboseFlag, extractList, excludeList); verboseFlag, extractList, excludeList);
close(tarFd); close(tarFd);
}
#ifdef BB_FEATURE_TAR_GZIP #ifdef BB_FEATURE_TAR_GZIP
gz_close(pid); if (unzipFlag == TRUE) {
fclose(comp_file); gz_close(pid);
fclose(comp_file);
}
#endif #endif
}
if (status == TRUE) if (status == TRUE)
return EXIT_SUCCESS; return EXIT_SUCCESS;

View File

@ -125,14 +125,13 @@ unsigned short mask_bits[] = {
//static int error_number = 0; //static int error_number = 0;
/* ======================================================================== /* ========================================================================
* Signal and error handler. * Signal and error handler.
*/
static void abort_gzip() static void abort_gzip()
{ {
error_msg("gzip aborted\n"); error_msg("gzip aborted\n");
// exit(ERROR); exit(ERROR);
return;
} }
*/
static void make_crc_table() static void make_crc_table()
{ {
@ -918,7 +917,7 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
in_file = l_in_file; in_file = l_in_file;
out_file = l_out_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); (void) signal(SIGINT, (sig_type) abort_gzip);
} }
#ifdef SIGTERM #ifdef SIGTERM
@ -931,7 +930,7 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
(void) signal(SIGHUP, (sig_type) abort_gzip); (void) signal(SIGHUP, (sig_type) abort_gzip);
} }
#endif #endif
*/
/* Allocate all global buffers (for DYN_ALLOC option) */ /* Allocate all global buffers (for DYN_ALLOC option) */
window = xmalloc((size_t)(((2L*WSIZE)+1L)*sizeof(unsigned char))); window = xmalloc((size_t)(((2L*WSIZE)+1L)*sizeof(unsigned char)));
outcnt = 0; outcnt = 0;
@ -1022,7 +1021,6 @@ extern int gz_open(FILE *compressed_file, int *pid)
{ {
int unzip_pipe[2]; int unzip_pipe[2];
// signal(SIGCHLD, abort_gzip);
if (pipe(unzip_pipe)!=0) { if (pipe(unzip_pipe)!=0) {
error_msg("pipe error"); error_msg("pipe error");
return(EXIT_FAILURE); return(EXIT_FAILURE);

9
tar.c
View File

@ -292,12 +292,13 @@ extern int tar_main(int argc, char **argv)
status = readTarFile(tarFd, extractFlag, listFlag, tostdoutFlag, status = readTarFile(tarFd, extractFlag, listFlag, tostdoutFlag,
verboseFlag, extractList, excludeList); verboseFlag, extractList, excludeList);
close(tarFd); close(tarFd);
}
#ifdef BB_FEATURE_TAR_GZIP #ifdef BB_FEATURE_TAR_GZIP
gz_close(pid); if (unzipFlag == TRUE) {
fclose(comp_file); gz_close(pid);
fclose(comp_file);
}
#endif #endif
}
if (status == TRUE) if (status == TRUE)
return EXIT_SUCCESS; return EXIT_SUCCESS;