From: nicm Date: Thu, 30 Apr 2015 14:30:53 +0000 (+0000) Subject: Add a comment about waitpid, suggested by espie@. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=843509fc09e8800608147a26083fbe5e3411a3c6;p=openbsd Add a comment about waitpid, suggested by espie@. --- 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);