diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2017-08-21 21:41:14 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2017-08-21 21:41:14 +0000 |
commit | c2cdcf41ccf92e65434001bc73d5d81b4c4210dd (patch) | |
tree | b806cd4f2e6e8fcd9ec7d6f315a0aa469b48521d /lib/libfuse | |
parent | e9d6f86c3468c07e6b1b12c0dd0b46516528e450 (diff) |
Use waitpid()/EINTR idiom for the specific pid, rather than generic wait(),
in case the parent process was started with a dangling child. This style
ensures any potential parent:child interlock isn't disrupted due to the
"wrong" child being waited on first. Then the other other childs can safely
zombie.
ok millert jca brynet
Diffstat (limited to 'lib/libfuse')
-rw-r--r-- | lib/libfuse/fuse.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libfuse/fuse.c b/lib/libfuse/fuse.c index 30fd62d4aac..7d50da596f5 100644 --- a/lib/libfuse/fuse.c +++ b/lib/libfuse/fuse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse.c,v 1.28 2016/05/24 19:24:46 okan Exp $ */ +/* $OpenBSD: fuse.c,v 1.29 2017/08/21 21:41:13 deraadt Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -294,7 +294,7 @@ ifuse_get_signal(unused int num) child = fork(); if (child < 0) - return ; + return; f = sigse->args; if (child == 0) { @@ -304,7 +304,10 @@ ifuse_get_signal(unused int num) } fuse_loop(f); - wait(&status); + while (waitpid(child, &status, 0) == -1) { + if (errno != EINTR) + break; + } } } |