diff options
author | Ron Yorston <rmy@pobox.com> | 2013-08-27 16:10:53 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2013-08-27 16:10:53 +0100 |
commit | 3fd34651ea72ea1c335d3170f234cb0517fd897f (patch) | |
tree | 36e8fc40cffd464ffda4759020777dd3ca23ca31 /archival/bbunzip.c | |
parent | e3ac39098326de084a805d0dd31db9666b734f20 (diff) | |
parent | d6ae4fb446daedfe3073d67be655942e9fa7eb18 (diff) | |
download | busybox-w32-3fd34651ea72ea1c335d3170f234cb0517fd897f.tar.gz busybox-w32-3fd34651ea72ea1c335d3170f234cb0517fd897f.tar.bz2 busybox-w32-3fd34651ea72ea1c335d3170f234cb0517fd897f.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'archival/bbunzip.c')
-rw-r--r-- | archival/bbunzip.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c index f77ac8383..9d1cd9485 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c | |||
@@ -132,7 +132,10 @@ int FAST_FUNC bbunpack(char **argv, | |||
132 | 132 | ||
133 | if (filename) { | 133 | if (filename) { |
134 | char *del = new_name; | 134 | char *del = new_name; |
135 | |||
135 | if (status >= 0) { | 136 | if (status >= 0) { |
137 | unsigned new_name_len; | ||
138 | |||
136 | /* TODO: restore other things? */ | 139 | /* TODO: restore other things? */ |
137 | if (aux.mtime != 0) { | 140 | if (aux.mtime != 0) { |
138 | struct timeval times[2]; | 141 | struct timeval times[2]; |
@@ -146,24 +149,31 @@ int FAST_FUNC bbunpack(char **argv, | |||
146 | utimes(new_name, times); /* ignoring errors */ | 149 | utimes(new_name, times); /* ignoring errors */ |
147 | } | 150 | } |
148 | 151 | ||
149 | /* Delete _compressed_ file */ | 152 | if (ENABLE_DESKTOP) |
153 | new_name_len = strlen(new_name); | ||
154 | /* Restore source filename (unless tgz -> tar case) */ | ||
155 | if (new_name == filename) { | ||
156 | new_name_len = strlen(filename); | ||
157 | filename[new_name_len] = '.'; | ||
158 | } | ||
159 | /* Extreme bloat for gunzip compat */ | ||
160 | /* Some users do want this info... */ | ||
161 | if (ENABLE_DESKTOP && (option_mask32 & OPT_VERBOSE)) { | ||
162 | unsigned percent = status | ||
163 | ? ((uoff_t)stat_buf.st_size * 100u / (unsigned long long)status) | ||
164 | : 0; | ||
165 | fprintf(stderr, "%s: %u%% - replaced with %.*s\n", | ||
166 | filename, | ||
167 | 100u - percent, | ||
168 | new_name_len, new_name | ||
169 | ); | ||
170 | } | ||
171 | /* Delete _source_ file */ | ||
150 | del = filename; | 172 | del = filename; |
151 | /* restore extension (unless tgz -> tar case) */ | ||
152 | if (new_name == filename) | ||
153 | filename[strlen(filename)] = '.'; | ||
154 | } | 173 | } |
155 | if (ENABLE_PLATFORM_MINGW32) | 174 | if (ENABLE_PLATFORM_MINGW32) |
156 | xclose(STDIN_FILENO); | 175 | xclose(STDIN_FILENO); |
157 | xunlink(del); | 176 | xunlink(del); |
158 | |||
159 | #if 0 /* Currently buggy - wrong name: "a.gz: 261% - replaced with a.gz" */ | ||
160 | /* Extreme bloat for gunzip compat */ | ||
161 | if (ENABLE_DESKTOP && (option_mask32 & OPT_VERBOSE) && status >= 0) { | ||
162 | fprintf(stderr, "%s: %u%% - replaced with %s\n", | ||
163 | filename, (unsigned)(stat_buf.st_size*100 / (status+1)), new_name); | ||
164 | } | ||
165 | #endif | ||
166 | |||
167 | free_name: | 177 | free_name: |
168 | if (new_name != filename) | 178 | if (new_name != filename) |
169 | free(new_name); | 179 | free(new_name); |