From 827dfe3fe1bc9da2c215f54a5124fb0edcc9321c Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 18 Apr 2023 16:46:38 -0500 Subject: [PATCH] Wait for compression program to exit, and pass on error result. --- toys/posix/tar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.39.2