Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2020-04-07 12:41:34 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2020-04-30 17:37:44 +0300
commitd1b75e1842b3e4f61daae2fb8a64d784a553f15c (patch)
treea8b5bb5175332f81cd3d9460acfabad4ad3fb9be
parent42a8984abc5eed709addac263aab43d64d47257d (diff)
httpd: permit non-default home directory with NOMMU enabled
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 <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/httpd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 1757e09c9..c2d226592 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -2737,7 +2737,12 @@ int httpd_main(int argc UNUSED_PARAM, char **argv)
}
#endif
- xchdir(home_httpd);
+ /* Chdir to home (unless we were re-execed for NOMMU case:
+ * we are already in the home dir then).
+ */
+ if (!re_execed)
+ xchdir(home_httpd);
+
if (!(opt & OPT_INETD)) {
signal(SIGCHLD, SIG_IGN);
server_socket = openServer();