From: Ron Yorston Date: Tue, 9 Jun 2020 15:38:21 +0000 (+0200) Subject: httpd: allow '-h' to work when daemonized with NOMMU enabled X-Git-Tag: 1_32_0~18 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=17764603f2a10bd43d174dc05512f38ab16a080a;p=oweals%2Fbusybox.git httpd: allow '-h' to work when daemonized with NOMMU enabled Commit d1b75e184 (httpd: permit non-default home directory with NOMMU enabled) only works when used with the '-f' (foreground) option. When '-f' isn't specified and NOMMU is enabled bb_daemonize_or_rexec() is called to daemonize the server. Since the server process has been re-execed the previous patch results in the xchdir() not being called. Fix this by resetting the re_execed variable in this case. Signed-off-by: Ron Yorston Signed-off-by: Denys Vlasenko --- diff --git a/networking/httpd.c b/networking/httpd.c index c2d226592..f4e95768f 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -2734,11 +2734,11 @@ int httpd_main(int argc UNUSED_PARAM, char **argv) #if !BB_MMU if (!(opt & OPT_FOREGROUND)) { bb_daemonize_or_rexec(0, argv); /* don't change current directory */ + re_execed = 0; /* for the following chdir to work */ } #endif - - /* Chdir to home (unless we were re-execed for NOMMU case: - * we are already in the home dir then). + /* Chdir to home (unless we were re_exec()ed for NOMMU case + * in mini_httpd_nommu(): we are already in the home dir then). */ if (!re_execed) xchdir(home_httpd);