commit d10c029b182fef1af4c6ec2713f9a8a3a5245edb
Author: Jan Klemkow <[email protected]>
AuthorDate: Thu Apr 16 23:19:21 2020 +0200
Commit: Jan Klemkow <[email protected]>
CommitDate: Thu Apr 16 23:19:21 2020 +0200
ptty: explicit wait for child
diff --git a/ptty.c b/ptty.c
index 156e1a5..0c30fd5 100644
--- 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);
}