open_transformer: do not duplicate "<program> -cf -"
text data bss dec hex filename 677858 738 7236 685832 a7708 busybox_old 677804 738 7236 685778 a76d2 busybox_unstripped
This commit is contained in:
@@ -8,12 +8,12 @@
|
||||
|
||||
/* transformer(), more than meets the eye */
|
||||
/*
|
||||
* On MMU machine, the transform_prog and ... are stripped
|
||||
* by a macro in include/unarchive.h. On NOMMU, transformer is stripped.
|
||||
* On MMU machine, the transform_prog is removed by macro magic
|
||||
* in include/unarchive.h. On NOMMU, transformer is removed.
|
||||
*/
|
||||
int open_transformer(int src_fd,
|
||||
USE_DESKTOP(long long) int (*transformer)(int src_fd, int dst_fd),
|
||||
const char *transform_prog, ...)
|
||||
const char *transform_prog)
|
||||
{
|
||||
int fd_pipe[2];
|
||||
int pid;
|
||||
@@ -29,9 +29,6 @@ int open_transformer(int src_fd,
|
||||
bb_perror_msg_and_die("fork failed");
|
||||
|
||||
if (pid == 0) {
|
||||
#if !BB_MMU
|
||||
va_list ap;
|
||||
#endif
|
||||
/* child process */
|
||||
close(fd_pipe[0]); /* We don't wan't to read from the parent */
|
||||
// FIXME: error check?
|
||||
@@ -43,12 +40,17 @@ int open_transformer(int src_fd,
|
||||
}
|
||||
exit(0);
|
||||
#else
|
||||
xmove_fd(src_fd, 0);
|
||||
xmove_fd(fd_pipe[1], 1);
|
||||
va_start(ap, transform_prog);
|
||||
/* hoping that va_list -> char** on our CPU is working... */
|
||||
BB_EXECVP(transform_prog, (void*)ap);
|
||||
bb_perror_msg_and_die("exec failed");
|
||||
{
|
||||
char *argv[4];
|
||||
xmove_fd(src_fd, 0);
|
||||
xmove_fd(fd_pipe[1], 1);
|
||||
argv[0] = (char*)transform_prog;
|
||||
argv[1] = (char*)"-cf";
|
||||
argv[2] = (char*)"-";
|
||||
argv[3] = NULL;
|
||||
BB_EXECVP(transform_prog, argv);
|
||||
bb_perror_msg_and_die("exec failed");
|
||||
}
|
||||
#endif
|
||||
/* notreached */
|
||||
}
|
||||
|
Reference in New Issue
Block a user