aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-11-19 14:44:04 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2013-11-19 14:44:04 +0100
commitebfa9b5aa1f1f6cd4949e1be03ebf1ce074727d1 (patch)
treee6a939e4d8b145ae0208f078a24ae89d9b7da629
parent8b59b2c13ededb2c82e36193b6d6e969df36531c (diff)
downloadbusybox-w32-ebfa9b5aa1f1f6cd4949e1be03ebf1ce074727d1.tar.gz
busybox-w32-ebfa9b5aa1f1f6cd4949e1be03ebf1ce074727d1.tar.bz2
busybox-w32-ebfa9b5aa1f1f6cd4949e1be03ebf1ce074727d1.zip
tar: fix exitcode check for MMU-spawned unpacking helpers
Testcase: tar xvzf EMPTY_FILE function old new delta open_transformer 102 106 +4 get_header_tar 1781 1785 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/libarchive/get_header_tar.c14
-rw-r--r--archival/libarchive/open_transformer.c5
2 files changed, 10 insertions, 9 deletions
diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c
index bc09756ba..32f842095 100644
--- a/archival/libarchive/get_header_tar.c
+++ b/archival/libarchive/get_header_tar.c
@@ -198,13 +198,13 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
198 * the message and we don't check whether we indeed 198 * the message and we don't check whether we indeed
199 * saw zero block directly before this. */ 199 * saw zero block directly before this. */
200 if (i == 0) { 200 if (i == 0) {
201 xfunc_error_retval = 0; 201 bb_error_msg("short read");
202 short_read: 202 /* this merely signals end of archive, not exit(1): */
203 bb_error_msg_and_die("short read"); 203 return EXIT_FAILURE;
204 } 204 }
205 if (i != 512) { 205 if (i != 512) {
206 IF_FEATURE_TAR_AUTODETECT(goto autodetect;) 206 IF_FEATURE_TAR_AUTODETECT(goto autodetect;)
207 goto short_read; 207 bb_error_msg_and_die("short read");
208 } 208 }
209 209
210#else 210#else
@@ -221,10 +221,10 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
221 */ 221 */
222 while (full_read(archive_handle->src_fd, &tar, 512) == 512) 222 while (full_read(archive_handle->src_fd, &tar, 512) == 512)
223 continue; 223 continue;
224 return EXIT_FAILURE; 224 return EXIT_FAILURE; /* "end of archive" */
225 } 225 }
226 archive_handle->tar__end = 1; 226 archive_handle->tar__end = 1;
227 return EXIT_SUCCESS; 227 return EXIT_SUCCESS; /* "decoded one header" */
228 } 228 }
229 archive_handle->tar__end = 0; 229 archive_handle->tar__end = 0;
230 230
@@ -471,5 +471,5 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
471 free(file_header->tar__uname); 471 free(file_header->tar__uname);
472 free(file_header->tar__gname); 472 free(file_header->tar__gname);
473#endif 473#endif
474 return EXIT_SUCCESS; 474 return EXIT_SUCCESS; /* "decoded one header" */
475} 475}
diff --git a/archival/libarchive/open_transformer.c b/archival/libarchive/open_transformer.c
index 4e44a87e9..4e9826441 100644
--- a/archival/libarchive/open_transformer.c
+++ b/archival/libarchive/open_transformer.c
@@ -79,16 +79,17 @@ void FAST_FUNC open_transformer(int fd, const char *transform_prog)
79 // FIXME: error check? 79 // FIXME: error check?
80#if BB_MMU 80#if BB_MMU
81 { 81 {
82 IF_DESKTOP(long long) int r;
82 transformer_aux_data_t aux; 83 transformer_aux_data_t aux;
83 init_transformer_aux_data(&aux); 84 init_transformer_aux_data(&aux);
84 aux.check_signature = check_signature; 85 aux.check_signature = check_signature;
85 transformer(&aux, fd, fd_pipe.wr); 86 r = transformer(&aux, fd, fd_pipe.wr);
86 if (ENABLE_FEATURE_CLEAN_UP) { 87 if (ENABLE_FEATURE_CLEAN_UP) {
87 close(fd_pipe.wr); /* send EOF */ 88 close(fd_pipe.wr); /* send EOF */
88 close(fd); 89 close(fd);
89 } 90 }
90 /* must be _exit! bug was actually seen here */ 91 /* must be _exit! bug was actually seen here */
91 _exit(EXIT_SUCCESS); 92 _exit(/*error if:*/ r < 0);
92 } 93 }
93#else 94#else
94 { 95 {