[PATCH] httpd: allow '-h' to work when daemonized with NOMMU enabled

Ron Yorston rmy at pobox.com
Thu Apr 30 19:32:56 UTC 2020


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 <rmy at pobox.com>
---
 networking/httpd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/networking/httpd.c b/networking/httpd.c
index c2d226592..abcb9aa2a 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -2734,6 +2734,7 @@ 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; /* pretend we haven't been re-execed... */
 	}
 #endif
 
-- 
2.25.4



More information about the busybox mailing list