diff options
author | Rob Landley <rob@landley.net> | 2023-04-18 16:46:38 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2023-04-18 16:46:38 -0500 |
commit | 827dfe3fe1bc9da2c215f54a5124fb0edcc9321c (patch) | |
tree | 11e476db1f8d84f25ff6c149ec9f3cb1d6a96238 | |
parent | 5083274a8a0b65d822e8ad669a1ffffb69a92220 (diff) | |
download | toybox-827dfe3fe1bc9da2c215f54a5124fb0edcc9321c.tar.gz |
Wait for compression program to exit, and pass on error result.
-rw-r--r-- | toys/posix/tar.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/toys/posix/tar.c b/toys/posix/tar.c index 5af32db8..ea8edbf7 100644 --- a/toys/posix/tar.c +++ b/toys/posix/tar.c @@ -1147,7 +1147,7 @@ void tar_main(void) if (FLAG(j)||FLAG(z)||FLAG(I)||FLAG(J)) { int pipefd[2] = {-1, TT.fd}; - xpopen_both((char *[]){get_archiver(), 0}, pipefd); + TT.pid = xpopen_both((char *[]){get_archiver(), 0}, pipefd); close(TT.fd); TT.fd = pipefd[0]; } @@ -1159,6 +1159,7 @@ void tar_main(void) } while (TT.incl != (dl = dl->next)); writeall(TT.fd, toybuf, 1024); + close(TT.fd); } if (TT.pid) { TT.pid = xpclose_both(TT.pid, 0); |