From 843509fc09e8800608147a26083fbe5e3411a3c6 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 30 Apr 2015 14:30:53 +0000 Subject: [PATCH] Add a comment about waitpid, suggested by espie@. --- usr.bin/file/sandbox.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usr.bin/file/sandbox.c b/usr.bin/file/sandbox.c index 2295a53efee..a4d42cf077f 100644 --- a/usr.bin/file/sandbox.c +++ b/usr.bin/file/sandbox.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sandbox.c,v 1.3 2015/04/30 14:16:49 nicm Exp $ */ +/* $OpenBSD: sandbox.c,v 1.4 2015/04/30 14:30:53 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -116,6 +116,11 @@ sandbox_fork(const char *user) return (sandbox_child(user)); } + /* + * Wait for the child to stop itself with SIGSTOP before assigning the + * policy, before that it might still be calling syscalls the policy + * would block. + */ do { pid = waitpid(pid, &status, WUNTRACED); } while (pid == -1 && errno == EINTR); -- 2.20.1