diff options
author | Ron Yorston <rmy@pobox.com> | 2020-06-09 17:38:21 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-06-09 17:38:21 +0200 |
commit | 17764603f2a10bd43d174dc05512f38ab16a080a (patch) | |
tree | 5b3905a1a35be135cc650b24cc5fe956eaf2c391 | |
parent | 0cad5f9b6dd80858c3ebb3893e04d2378eddc872 (diff) | |
download | busybox-w32-17764603f2a10bd43d174dc05512f38ab16a080a.tar.gz busybox-w32-17764603f2a10bd43d174dc05512f38ab16a080a.tar.bz2 busybox-w32-17764603f2a10bd43d174dc05512f38ab16a080a.zip |
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 <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/httpd.c | 6 |
1 files changed, 3 insertions, 3 deletions
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) | |||
2734 | #if !BB_MMU | 2734 | #if !BB_MMU |
2735 | if (!(opt & OPT_FOREGROUND)) { | 2735 | if (!(opt & OPT_FOREGROUND)) { |
2736 | bb_daemonize_or_rexec(0, argv); /* don't change current directory */ | 2736 | bb_daemonize_or_rexec(0, argv); /* don't change current directory */ |
2737 | re_execed = 0; /* for the following chdir to work */ | ||
2737 | } | 2738 | } |
2738 | #endif | 2739 | #endif |
2739 | 2740 | /* Chdir to home (unless we were re_exec()ed for NOMMU case | |
2740 | /* Chdir to home (unless we were re-execed for NOMMU case: | 2741 | * in mini_httpd_nommu(): we are already in the home dir then). |
2741 | * we are already in the home dir then). | ||
2742 | */ | 2742 | */ |
2743 | if (!re_execed) | 2743 | if (!re_execed) |
2744 | xchdir(home_httpd); | 2744 | xchdir(home_httpd); |