Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115698498
D44401.id135860.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
798 B
Referenced Files
None
Subscribers
None
D44401.id135860.diff
View Options
diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c
--- a/usr.sbin/daemon/daemon.c
+++ b/usr.sbin/daemon/daemon.c
@@ -755,18 +755,21 @@
}
/*
- * Returns true if SIGCHILD came from state->pid
- * This function could hang if SIGCHILD was emittied for a reason other than
- * child dying (e.g., ptrace attach).
+ * Returns true if SIGCHILD came from state->pid due to its exit.
*/
static bool
daemon_is_child_dead(struct daemon_state *state)
{
+ int status;
+
for (;;) {
- int who = waitpid(-1, NULL, WNOHANG);
- if (state->pid == who) {
+ int who = waitpid(-1, &status, WNOHANG);
+ if (state->pid == who && WIFEXITED(status)) {
return true;
}
+ if (who == 0) {
+ return (false);
+ }
if (who == -1 && errno != EINTR) {
warn("waitpid");
return false;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 28, 7:59 AM (9 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17827432
Default Alt Text
D44401.id135860.diff (798 B)
Attached To
Mode
D44401: daemon(8): handle case of waitpid() returning without exited child
Attached
Detach File
Event Timeline
Log In to Comment