ftpd: do not use root_fd if we are not in chroot

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2014-06-27 13:53:35 +02:00
parent 27c290f7f2
commit 9d7cbdeee3
1 changed files with 5 additions and 2 deletions

View File

@ -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]);
}