diff options
author | Rob Landley <rob@landley.net> | 2015-09-29 05:09:46 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2015-09-29 05:09:46 -0500 |
commit | 7d6af77804adc069a83e8566250f868a6cb9786e (patch) | |
tree | 92b6b57f55c41ab13164c1d448b3cdd1129703b4 /toys/posix/cpio.c | |
parent | 3b51a07e478d64a84e40b3a7c026b2f8566b194b (diff) | |
download | toybox-7d6af77804adc069a83e8566250f868a6cb9786e.tar.gz |
Make defconfig build for nommu.
Adds XVFORK() macro, teaches xpopen_both() to call /proc/self/exe with NULL
argv (and converts cpio -p to use that), adds TOYBOX_FORK guards to some
unconverted commands.
Diffstat (limited to 'toys/posix/cpio.c')
-rw-r--r-- | toys/posix/cpio.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/toys/posix/cpio.c b/toys/posix/cpio.c index 312bb939..a442f0d1 100644 --- a/toys/posix/cpio.c +++ b/toys/posix/cpio.c @@ -82,12 +82,15 @@ void cpio_main(void) // In passthrough mode, parent stays in original dir and generates archive // to pipe, child does chdir to new dir and reads archive from stdin (pipe). if (TT.pass) { - if (!(pid = xpopen(0, &pipe, 0))) { + if (toys.stacktop) { + // xpopen() doesn't return from child due to vfork(), instead restarts + // with !toys.stacktop + pid = xpopen(0, &pipe, 0); + afd = pipe; + } else { + // child toys.optflags |= FLAG_i; xchdir(TT.pass); - } else { - toys.optflags |= FLAG_o; - afd = pipe; } } |