aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/ftpd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/networking/ftpd.c b/networking/ftpd.c
index e7cf5f431..2d2a3a44c 100644
--- a/networking/ftpd.c
+++ b/networking/ftpd.c
@@ -1173,11 +1173,14 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv)
applet_name = xasprintf("%s[%u]", applet_name, (int)getpid());
#if !BB_MMU
- G.root_fd = xopen("/", O_RDONLY | O_DIRECTORY);
- close_on_exec_on(G.root_fd);
+ G.root_fd = -1;
#endif
argv += optind;
if (argv[0]) {
+#if !BB_MMU
+ G.root_fd = xopen("/", O_RDONLY | O_DIRECTORY);
+ close_on_exec_on(G.root_fd);
+#endif
xchroot(argv[0]);
}