When BusyBox is compiled with NOMMU enabled running httpd with the '-h' option fails even if the specified directory exists:
$ ls -d www www $ busybox httpd -fvvvp 8080 -h www ... ... try to access http://localhost:8080/www ... httpd: can't change directory to 'www': No such file or directory The parent process executes xchdir("www"). When a connection is accepted it's handled by re-executing httpd in inetd mode. The child process inherits the current directory "www" and tries to change directory again to "www", which fails. Omit the call to xchdir() when httpd is re-executed. Signed-off-by: Ron Yorston <[email protected]> --- networking/httpd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/networking/httpd.c b/networking/httpd.c index 1757e09c9..739ed4130 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -2737,7 +2737,10 @@ int httpd_main(int argc UNUSED_PARAM, char **argv) } #endif - xchdir(home_httpd); +#if !BB_MMU + if (!re_execed) +#endif + xchdir(home_httpd); if (!(opt & OPT_INETD)) { signal(SIGCHLD, SIG_IGN); server_socket = openServer(); -- 2.25.1 _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
