[PATCH] httpd: permit non-default home directory with NOMMU enabled
Denys Vlasenko
vda.linux at googlemail.com
Thu Apr 30 14:37:35 UTC 2020
On Tue, Apr 7, 2020 at 11:41 AM Ron Yorston <rmy at pobox.com> wrote:
>
> 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.
Does the fix also work without -f (IOW: if daemonized?)
> }
> #endif
>
> - xchdir(home_httpd);
> +#if !BB_MMU
> + if (!re_execed)
> +#endif
#if is not necessary, re_exec is constant 0 for MMU build.
> + xchdir(home_httpd);
> if (!(opt & OPT_INETD)) {
> signal(SIGCHLD, SIG_IGN);
> server_socket = openServer();
More information about the busybox
mailing list