[LEDE-DEV] [PATCH procd 2/7] jail: regroup add_path_and_deps() calls

Etienne CHAMPETIER champetier.etienne at gmail.com
Sun May 29 16:39:13 PDT 2016


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 at gmail.com>
---
 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);
 
-- 
1.9.1




More information about the Lede-dev mailing list