jail: regroup add_path_and_deps() calls
authorEtienne CHAMPETIER <champetier.etienne@gmail.com>
Sun, 29 May 2016 23:39:13 +0000 (23:39 +0000)
committerJohn Crispin <john@phrozen.org>
Wed, 1 Jun 2016 08:27:35 +0000 (10:27 +0200)
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 <champetier.etienne@gmail.com>
jail/jail.c

index 8157a8ff6f0ccc77434c26e45dded40549a8ff14..95d6237419498696869c2658391886cff2dafdb8 100644 (file)
@@ -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);