[hackers] [scroll] ptty: explicit wait for child || Jan Klemkow
commit d10c029b182fef1af4c6ec2713f9a8a3a5245edb
Author: Jan Klemkow <j.klemkow_AT_wemelug.de>
AuthorDate: Thu Apr 16 23:19:21 2020 +0200
Commit: Jan Klemkow <j.klemkow_AT_wemelug.de>
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
_AT_@ -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);
}
Received on Thu Apr 16 2020 - 23:22:00 CEST
This archive was generated by hypermail 2.3.0
: Thu Apr 16 2020 - 23:24:37 CEST