[LEDE-DEV] [PATCH procd 7/7] jail: don't CLONE_NEWUTS if we don't change hostname
Etienne CHAMPETIER
champetier.etienne at gmail.com
Sun May 29 16:39:18 PDT 2016
Signed-off-by: Etienne CHAMPETIER <champetier.etienne at gmail.com>
---
jail/jail.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/jail/jail.c b/jail/jail.c
index e425254..926e42c 100644
--- a/jail/jail.c
+++ b/jail/jail.c
@@ -386,9 +386,10 @@ int main(int argc, char **argv)
uloop_init();
if (opts.namespace) {
- jail_process.pid = clone(exec_jail,
- child_stack + STACK_SIZE,
- CLONE_NEWUTS | CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWIPC | SIGCHLD, NULL);
+ int flags = CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWIPC | SIGCHLD;
+ if (opts.hostname)
+ flags |= CLONE_NEWUTS;
+ jail_process.pid = clone(exec_jail, child_stack + STACK_SIZE, flags, NULL);
} else {
jail_process.pid = fork();
}
--
1.9.1
More information about the Lede-dev
mailing list