diff options
Diffstat (limited to 'archival/libunarchive/get_header_tar_bz2.c')
-rw-r--r-- | archival/libunarchive/get_header_tar_bz2.c | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/archival/libunarchive/get_header_tar_bz2.c b/archival/libunarchive/get_header_tar_bz2.c index 6354648fc..d49d6b96a 100644 --- a/archival/libunarchive/get_header_tar_bz2.c +++ b/archival/libunarchive/get_header_tar_bz2.c | |||
@@ -26,53 +26,13 @@ | |||
26 | 26 | ||
27 | extern char get_header_tar_bz2(archive_handle_t *archive_handle) | 27 | extern char get_header_tar_bz2(archive_handle_t *archive_handle) |
28 | { | 28 | { |
29 | int fd_pipe[2]; | ||
30 | int pid; | ||
31 | |||
32 | /* Cant lseek over pipe's */ | 29 | /* Cant lseek over pipe's */ |
33 | archive_handle->read = safe_read; | ||
34 | archive_handle->seek = seek_by_char; | 30 | archive_handle->seek = seek_by_char; |
35 | 31 | ||
36 | if (pipe(fd_pipe) != 0) { | 32 | archive_handle->src_fd = open_transformer(archive_handle->src_fd, uncompressStream); |
37 | bb_error_msg_and_die("Can't create pipe"); | ||
38 | } | ||
39 | |||
40 | pid = fork(); | ||
41 | if (pid == -1) { | ||
42 | bb_error_msg_and_die("Fork failed\n"); | ||
43 | } | ||
44 | |||
45 | if (pid == 0) { | ||
46 | /* child process */ | ||
47 | int status; | ||
48 | |||
49 | close(fd_pipe[0]); /* We don't wan't to read from the pipe */ | ||
50 | uncompressStream(archive_handle->src_fd, fd_pipe[1]); | ||
51 | close(fd_pipe[1]); /* Send EOF */ | ||
52 | exit(status); | ||
53 | /* notreached */ | ||
54 | } | ||
55 | /* parent process */ | ||
56 | close(fd_pipe[1]); /* Don't want to write down the pipe */ | ||
57 | close(archive_handle->src_fd); | ||
58 | |||
59 | archive_handle->src_fd = fd_pipe[0]; | ||
60 | |||
61 | archive_handle->offset = 0; | 33 | archive_handle->offset = 0; |
62 | while (get_header_tar(archive_handle) == EXIT_SUCCESS); | 34 | while (get_header_tar(archive_handle) == EXIT_SUCCESS); |
63 | 35 | ||
64 | close(fd_pipe[0]); | ||
65 | #if 0 | ||
66 | if (kill(pid, SIGTERM) == -1) { | ||
67 | bb_error_msg_and_die("Couldnt kill gunzip process"); | ||
68 | } | ||
69 | #endif | ||
70 | |||
71 | /* I dont think this is needed */ | ||
72 | if (waitpid(pid, NULL, 0) == -1) { | ||
73 | bb_error_msg("Couldnt wait ?"); | ||
74 | } | ||
75 | |||
76 | /* Can only do one file at a time */ | 36 | /* Can only do one file at a time */ |
77 | return(EXIT_FAILURE); | 37 | return(EXIT_FAILURE); |
78 | } | 38 | } |