=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/file/Attic/sandbox.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- src/usr.bin/file/Attic/sandbox.c 2015/04/30 14:16:49 1.3 +++ src/usr.bin/file/Attic/sandbox.c 2015/04/30 14:30:53 1.4 @@ -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 @@ 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);