From 42c4505e1e5eb96314176e7b7c1b28adcce22310 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Wed, 27 May 2015 15:10:16 +0100 Subject: mingw: define a macro for spawn --- include/mingw.h | 3 ++- libbb/vfork_daemon_rexec.c | 5 ++--- win32/process.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/mingw.h b/include/mingw.h index 84522f032..d6ed909b5 100644 --- a/include/mingw.h +++ b/include/mingw.h @@ -433,12 +433,13 @@ int utimes(const char *file_name, const struct timeval times[2]); #define is_dir_sep(c) ((c) == '/' || (c) == '\\') #define PRIuMAX "I64u" -pid_t mingw_spawn(char **argv); +pid_t FAST_FUNC mingw_spawn(char **argv); int mingw_execv(const char *cmd, const char *const *argv); int mingw_execvp(const char *cmd, const char *const *argv); int mingw_execve(const char *cmd, const char *const *argv, const char *const *envp); pid_t mingw_spawn_applet(int mode, const char *applet, const char *const *argv, const char *const *envp); pid_t mingw_spawn_1(int mode, const char *cmd, const char *const *argv, const char *const *envp); +#define spawn mingw_spawn #define execvp mingw_execvp #define execve mingw_execve #define execv mingw_execv diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c index 6611dabfa..de4d14fce 100644 --- a/libbb/vfork_daemon_rexec.c +++ b/libbb/vfork_daemon_rexec.c @@ -17,6 +17,7 @@ #include "busybox.h" /* uses applet tables */ +#if !ENABLE_PLATFORM_MINGW32 /* This does a fork/exec in one call, using vfork(). Returns PID of new child, * -1 for failure. Runs argv[0], searching path if that has no / in it. */ pid_t FAST_FUNC spawn(char **argv) @@ -25,9 +26,6 @@ pid_t FAST_FUNC spawn(char **argv) volatile int failed; pid_t pid; - if (ENABLE_PLATFORM_MINGW32) - return mingw_spawn(argv); - fflush_all(); /* Be nice to nommu machines. */ @@ -61,6 +59,7 @@ pid_t FAST_FUNC spawn(char **argv) } return pid; } +#endif /* Die with an error message if we can't spawn a child process. */ pid_t FAST_FUNC xspawn(char **argv) diff --git a/win32/process.c b/win32/process.c index dc9e98305..e9db5311e 100644 --- a/win32/process.c +++ b/win32/process.c @@ -296,7 +296,7 @@ mingw_spawn_1(int mode, const char *cmd, const char *const *argv, const char *co return ret; } -pid_t +pid_t FAST_FUNC mingw_spawn(char **argv) { return mingw_spawn_1(P_NOWAIT, argv[0], (const char *const *)argv, (const char *const *)environ); -- cgit v1.2.3-55-g6feb