[git commit] ftpd: do not use root_fd if we are not in chroot
Denys Vlasenko
vda.linux at googlemail.com
Fri Jun 27 11:53:35 UTC 2014
commit: http://git.busybox.net/busybox/commit/?id=9d7cbdeee3545d36db201a2d822cd2bd10074add
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
networking/ftpd.c | 7 +++++--
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]);
}
More information about the busybox-cvs
mailing list