From 890adc9a79f1d6189917d6a149ed2a012844cb33 Mon Sep 17 00:00:00 2001 From: Etienne CHAMPETIER Date: Sun, 29 May 2016 23:39:13 +0000 Subject: [PATCH] jail: regroup add_path_and_deps() calls we are already calling add_path_and_deps() while parsing -r/-w options, so move the 2 remaining calls into main() Signed-off-by: Etienne CHAMPETIER --- jail/jail.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/jail/jail.c b/jail/jail.c index 8157a8f..95d6237 100644 --- a/jail/jail.c +++ b/jail/jail.c @@ -139,16 +139,6 @@ static int build_jail_fs(void) return -1; } - if (add_path_and_deps(*opts.jail_argv, 1, -1, 0)) { - ERROR("failed to load dependencies\n"); - return -1; - } - - if (opts.seccomp && add_path_and_deps("libpreload-seccomp.so", 1, -1, 1)) { - ERROR("failed to load libpreload-seccomp.so\n"); - return -1; - } - if (mount_all(jail_root)) { ERROR("mount_all() failed\n"); return -1; @@ -379,6 +369,16 @@ int main(int argc, char **argv) opts.jail_argv = &argv[optind]; + if (opts.namespace && add_path_and_deps(*opts.jail_argv, 1, -1, 0)) { + ERROR("failed to load dependencies\n"); + return -1; + } + + if (opts.namespace && opts.seccomp && add_path_and_deps("libpreload-seccomp.so", 1, -1, 1)) { + ERROR("failed to load libpreload-seccomp.so\n"); + return -1; + } + if (opts.name) prctl(PR_SET_NAME, opts.name, NULL, NULL, NULL); -- 2.25.1