diff options
Diffstat (limited to 'libbb/deb_extract.c')
-rw-r--r-- | libbb/deb_extract.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libbb/deb_extract.c b/libbb/deb_extract.c index 0f5a570b6..b95dfa4d4 100644 --- a/libbb/deb_extract.c +++ b/libbb/deb_extract.c | |||
@@ -75,11 +75,24 @@ extern int deb_extract(const char *package_filename, int function, char *argumen | |||
75 | if (function & extract_fsys_tarfile) { | 75 | if (function & extract_fsys_tarfile) { |
76 | copy_file_chunk(uncompressed_file, stdout, -1); | 76 | copy_file_chunk(uncompressed_file, stdout, -1); |
77 | } else { | 77 | } else { |
78 | untar(uncompressed_file, function, argument); | 78 | char *output_buffer = NULL; |
79 | output_buffer = untar(uncompressed_file, stdout, function, argument); | ||
80 | if (function & extract_field) { | ||
81 | char *field = NULL; | ||
82 | int field_length = 0; | ||
83 | int field_start = 0; | ||
84 | while ((field = read_package_field(&output_buffer[field_start])) != NULL) { | ||
85 | field_length = strlen(field); | ||
86 | field_start += (field_length + 1); | ||
87 | if (strstr(field, argument) == field) { | ||
88 | printf("%s\n", field + strlen(argument) + 2); | ||
89 | } | ||
90 | free(field); | ||
91 | } | ||
92 | } | ||
79 | } | 93 | } |
80 | /* we are deliberately terminating the child so we can safely ignore this */ | ||
81 | gz_close(gunzip_pid); | ||
82 | 94 | ||
95 | gz_close(gunzip_pid); | ||
83 | fclose(deb_file); | 96 | fclose(deb_file); |
84 | fclose(uncompressed_file); | 97 | fclose(uncompressed_file); |
85 | free(ared_file); | 98 | free(ared_file); |