commit d10c029b182fef1af4c6ec2713f9a8a3a5245edb
parent ea938bbb0415e745bc969e4bf4123a41723e740f
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date: Thu, 16 Apr 2020 23:19:21 +0200
ptty: explicit wait for child
Diffstat:
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/ptty.c b/ptty.c
@@ -138,11 +138,9 @@ main(int argc, char *argv[])
break;
}
- pid_t pid;
int status;
- while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
- if (pid != child)
- continue;
+ if (waitpid(child, &status, 0) != child)
+ die("waitpid:");
return WEXITSTATUS(status);
}