Merge pull request #632 from adfernandes/master
nsexec: don't use CLONE_PARENT and CLONE_NEWPID together
This commit is contained in:
commit
9ea3372d04
|
@ -14,6 +14,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/prctl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <bits/sockaddr.h>
|
#include <bits/sockaddr.h>
|
||||||
|
@ -84,6 +85,14 @@ static int clone_parent(jmp_buf *env, int flags)
|
||||||
ca.env = env;
|
ca.env = env;
|
||||||
child = clone(child_func, ca.stack_ptr, CLONE_PARENT | SIGCHLD | flags,
|
child = clone(child_func, ca.stack_ptr, CLONE_PARENT | SIGCHLD | flags,
|
||||||
&ca);
|
&ca);
|
||||||
|
if (child == -1 && errno == EINVAL) {
|
||||||
|
if (unshare(flags)) {
|
||||||
|
pr_perror("Unable to unshare namespaces");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
child = clone(child_func, ca.stack_ptr, SIGCHLD | CLONE_PARENT,
|
||||||
|
&ca);
|
||||||
|
}
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue