1 /* vi: set sw=4 ts=4: */
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
9 /* transformer(), more than meets the eye */
11 * On MMU machine, the transform_prog and ... are stripped
12 * by a macro in include/unarchive.h. On NOMMU, transformer is stripped.
14 int open_transformer(int src_fd,
15 USE_DESKTOP(long long) int (*transformer)(int src_fd, int dst_fd),
16 const char *transform_prog, ...)
29 bb_perror_msg_and_die("fork failed");
36 close(fd_pipe[0]); /* We don't wan't to read from the parent */
37 // FIXME: error check?
39 transformer(src_fd, fd_pipe[1]);
40 if (ENABLE_FEATURE_CLEAN_UP) {
41 close(fd_pipe[1]); /* Send EOF */
47 xmove_fd(fd_pipe[1], 1);
48 va_start(ap, transform_prog);
49 /* hoping that va_list -> char** on our CPU is working... */
50 BB_EXECVP(transform_prog, (void*)ap);
51 bb_perror_msg_and_die("exec failed");
57 close(fd_pipe[1]); /* Don't want to write to the child */