summaryrefslogtreecommitdiffstats
path: root/lib/libfuse
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2017-08-21 21:41:13 +0000
committerderaadt <deraadt@openbsd.org>2017-08-21 21:41:13 +0000
commit2aeb6b04aa176ef63e3c80e808b0825f52f9d667 (patch)
treef878ca55fb6ebedeea2cc01fc560d344bd407c0c /lib/libfuse
parentMove the kernel relinking code from /etc/rc into a seperate script (diff)
downloadwireguard-openbsd-2aeb6b04aa176ef63e3c80e808b0825f52f9d667.tar.xz
wireguard-openbsd-2aeb6b04aa176ef63e3c80e808b0825f52f9d667.zip
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.c9
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;
+ }
}
}