diff options
author | Ron Yorston <rmy@pobox.com> | 2023-12-15 11:55:30 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-12-15 11:55:30 +0000 |
commit | ba7d37766ec090e87a6a9cc3af685521390c6c6d (patch) | |
tree | e50a0ecb67c22bbcb497b9eea7208f7c75789b6a /networking | |
parent | 06e977c68e8cbfdd50b19a9197f31ba5af02c0d4 (diff) | |
download | busybox-w32-ba7d37766ec090e87a6a9cc3af685521390c6c6d.tar.gz busybox-w32-ba7d37766ec090e87a6a9cc3af685521390c6c6d.tar.bz2 busybox-w32-ba7d37766ec090e87a6a9cc3af685521390c6c6d.zip |
httpd: fix return code when run in background
When httpd was run in the background the return code of the parent
process was incorrect. It seems when spawn() is run in _P_DETACH
mode it returns 0 on success, not a process handle.
Fix the test for the return code and alter mingw_spawn_detach()
so it doesn't treat the return from spawn() as a handle.
Saves 32 bytes.
Diffstat (limited to 'networking')
-rw-r--r-- | networking/httpd.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/networking/httpd.c b/networking/httpd.c index 2b2d14076..0de56a47a 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -2863,9 +2863,7 @@ static void mingw_daemonize(char **argv) | |||
2863 | xdup2(fd, 2); | 2863 | xdup2(fd, 2); |
2864 | close(fd); | 2864 | close(fd); |
2865 | 2865 | ||
2866 | if (mingw_spawn_detach(new_argv)) | 2866 | exit(mingw_spawn_detach(new_argv) == -1 ? EXIT_FAILURE : EXIT_SUCCESS); |
2867 | exit_SUCCESS(); /* parent */ | ||
2868 | exit(EXIT_FAILURE); /* parent */ | ||
2869 | } | 2867 | } |
2870 | #endif | 2868 | #endif |
2871 | 2869 | ||