summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenys Vlasenko2014-06-27 13:53:35 +0200
committerDenys Vlasenko2014-06-27 13:53:35 +0200
commit9d7cbdeee3545d36db201a2d822cd2bd10074add (patch)
treefcfe36089e7130c3e3b3f21d96d6abd176c8e9fd /networking
parent27c290f7f29fc57385d53893bfd7301db4708e9c (diff)
downloadbusybox-9d7cbdeee3545d36db201a2d822cd2bd10074add.zip
busybox-9d7cbdeee3545d36db201a2d822cd2bd10074add.tar.gz
ftpd: do not use root_fd if we are not in chroot
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r--networking/ftpd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/networking/ftpd.c b/networking/ftpd.c
index e7cf5f4..2d2a3a4 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]);
}