diff options
author | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-06-20 07:48:00 +0000 |
---|---|---|
committer | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-06-20 07:48:00 +0000 |
commit | 6b3952392e20d78ddf4ef906bc0ee44d040c72da (patch) | |
tree | 48535c1f250f98707e595cfb83f47c83332c4fc9 /libbb/gz_open.c | |
parent | e979da5a0d154202e5422cfe6997e52683372fdb (diff) | |
download | busybox-w32-6b3952392e20d78ddf4ef906bc0ee44d040c72da.tar.gz busybox-w32-6b3952392e20d78ddf4ef906bc0ee44d040c72da.tar.bz2 busybox-w32-6b3952392e20d78ddf4ef906bc0ee44d040c72da.zip |
Reorganise unarchiving functions, more code re-use, only does single pass(no more linked lists), basis for supporting a cpio (and cheaper untar) applet, but cpio applet isnt included in this.
It effects ar, dpkg-deb applets only
git-svn-id: svn://busybox.net/trunk/busybox@2862 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb/gz_open.c')
-rw-r--r-- | libbb/gz_open.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libbb/gz_open.c b/libbb/gz_open.c index 19ec0a066..b23920b16 100644 --- a/libbb/gz_open.c +++ b/libbb/gz_open.c | |||
@@ -6,17 +6,17 @@ | |||
6 | #include <unistd.h> | 6 | #include <unistd.h> |
7 | #include "libbb.h" | 7 | #include "libbb.h" |
8 | 8 | ||
9 | extern int gz_open(FILE *compressed_file, int *pid) | 9 | extern FILE *gz_open(FILE *compressed_file, int *pid) |
10 | { | 10 | { |
11 | int unzip_pipe[2]; | 11 | int unzip_pipe[2]; |
12 | 12 | ||
13 | if (pipe(unzip_pipe)!=0) { | 13 | if (pipe(unzip_pipe)!=0) { |
14 | error_msg("pipe error"); | 14 | error_msg("pipe error"); |
15 | return(EXIT_FAILURE); | 15 | return(NULL); |
16 | } | 16 | } |
17 | if ((*pid = fork()) == -1) { | 17 | if ((*pid = fork()) == -1) { |
18 | error_msg("fork failured"); | 18 | error_msg("fork failured"); |
19 | return(EXIT_FAILURE); | 19 | return(NULL); |
20 | } | 20 | } |
21 | if (*pid==0) { | 21 | if (*pid==0) { |
22 | /* child process */ | 22 | /* child process */ |
@@ -27,7 +27,9 @@ extern int gz_open(FILE *compressed_file, int *pid) | |||
27 | close(unzip_pipe[1]); | 27 | close(unzip_pipe[1]); |
28 | exit(EXIT_SUCCESS); | 28 | exit(EXIT_SUCCESS); |
29 | } | 29 | } |
30 | |||
31 | close(unzip_pipe[1]); | 30 | close(unzip_pipe[1]); |
32 | return(unzip_pipe[0]); | 31 | if (unzip_pipe[0] == -1) { |
33 | } \ No newline at end of file | 32 | error_msg("Couldnt initialise gzip stream"); |
33 | } | ||
34 | return(fdopen(unzip_pipe[0], "r")); | ||
35 | } | ||