From 9d7cbdeee3545d36db201a2d822cd2bd10074add Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 27 Jun 2014 13:53:35 +0200 Subject: ftpd: do not use root_fd if we are not in chroot Signed-off-by: Denys Vlasenko --- networking/ftpd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'networking') 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]); } -- cgit v1.1