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>
This commit is contained in:
parent
8b59b2c13e
commit
ebfa9b5aa1
@ -198,13 +198,13 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
|
|||||||
* the message and we don't check whether we indeed
|
* the message and we don't check whether we indeed
|
||||||
* saw zero block directly before this. */
|
* saw zero block directly before this. */
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
xfunc_error_retval = 0;
|
bb_error_msg("short read");
|
||||||
short_read:
|
/* this merely signals end of archive, not exit(1): */
|
||||||
bb_error_msg_and_die("short read");
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
if (i != 512) {
|
if (i != 512) {
|
||||||
IF_FEATURE_TAR_AUTODETECT(goto autodetect;)
|
IF_FEATURE_TAR_AUTODETECT(goto autodetect;)
|
||||||
goto short_read;
|
bb_error_msg_and_die("short read");
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -221,10 +221,10 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
|
|||||||
*/
|
*/
|
||||||
while (full_read(archive_handle->src_fd, &tar, 512) == 512)
|
while (full_read(archive_handle->src_fd, &tar, 512) == 512)
|
||||||
continue;
|
continue;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE; /* "end of archive" */
|
||||||
}
|
}
|
||||||
archive_handle->tar__end = 1;
|
archive_handle->tar__end = 1;
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS; /* "decoded one header" */
|
||||||
}
|
}
|
||||||
archive_handle->tar__end = 0;
|
archive_handle->tar__end = 0;
|
||||||
|
|
||||||
@ -471,5 +471,5 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
|
|||||||
free(file_header->tar__uname);
|
free(file_header->tar__uname);
|
||||||
free(file_header->tar__gname);
|
free(file_header->tar__gname);
|
||||||
#endif
|
#endif
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS; /* "decoded one header" */
|
||||||
}
|
}
|
||||||
|
@ -79,16 +79,17 @@ void FAST_FUNC open_transformer(int fd, const char *transform_prog)
|
|||||||
// FIXME: error check?
|
// FIXME: error check?
|
||||||
#if BB_MMU
|
#if BB_MMU
|
||||||
{
|
{
|
||||||
|
IF_DESKTOP(long long) int r;
|
||||||
transformer_aux_data_t aux;
|
transformer_aux_data_t aux;
|
||||||
init_transformer_aux_data(&aux);
|
init_transformer_aux_data(&aux);
|
||||||
aux.check_signature = check_signature;
|
aux.check_signature = check_signature;
|
||||||
transformer(&aux, fd, fd_pipe.wr);
|
r = transformer(&aux, fd, fd_pipe.wr);
|
||||||
if (ENABLE_FEATURE_CLEAN_UP) {
|
if (ENABLE_FEATURE_CLEAN_UP) {
|
||||||
close(fd_pipe.wr); /* send EOF */
|
close(fd_pipe.wr); /* send EOF */
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
/* must be _exit! bug was actually seen here */
|
/* must be _exit! bug was actually seen here */
|
||||||
_exit(EXIT_SUCCESS);
|
_exit(/*error if:*/ r < 0);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user