int unzip_pipe[2];
if (pipe(unzip_pipe)!=0) {
- error_msg("pipe error");
+ perror_msg("%s: pipe: ", __FUNCTION__);
return(NULL);
}
if ((*pid = fork()) == -1) {
- error_msg("fork failed");
+ perror_msg("%s: fork: ", __FUNCTION__);
return(NULL);
}
if (*pid==0) {
exit(EXIT_SUCCESS);
}
close(unzip_pipe[1]);
- if (unzip_pipe[0] == -1) {
- error_msg("gzip stream init failed");
- }
return(fdopen(unzip_pipe[0], "r"));
}
+
+extern void gz_close(int gunzip_pid)
+{
+ if (kill(gunzip_pid, SIGTERM) == -1) {
+ perror_msg_and_die("%s: kill(gunzip_pid): ", __FUNCTION__);
+ }
+
+ if (waitpid(gunzip_pid, NULL, 0) == -1) {
+ perror_msg("%s wait: ", __FUNCTION__);
+ }
+}
return exit_code;
}
-
-/*
- * This needs access to global variables wondow and crc_table, so its not in its own file.
- */
-extern void gz_close(int gunzip_pid)
-{
- if (kill(gunzip_pid, SIGTERM) == -1) {
- error_msg_and_die("*** Couldnt kill old gunzip process *** aborting");
- }
-
- if (waitpid(gunzip_pid, NULL, 0) == -1) {
- printf("Couldnt wait ?");
- }
- free(window);
- free(crc_table);
-}