From 4988f3c4cc3cb9e8b1ccb06e84768c177cb13385 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 17 May 2016 08:29:14 +0100 Subject: win32: adjustments to spawn functions Make mingw_spawn_applet and mingw_spawn_1 static. The return value from spawnve is an exit code in synchronous mode and a process handle in asynchronous mode. Pass these upwards without interpretation. --- win32/process.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'win32') diff --git a/win32/process.c b/win32/process.c index 951519e59..8cd1dc28c 100644 --- a/win32/process.c +++ b/win32/process.c @@ -4,7 +4,7 @@ int waitpid(pid_t pid, int *status, int options) { HANDLE proc; - int ret; + intptr_t ret; /* Windows does not understand parent-child */ if (pid > 0 && options == 0) { @@ -12,7 +12,7 @@ int waitpid(pid_t pid, int *status, int options) FALSE, pid)) != NULL ) { ret = _cwait(status, (intptr_t)proc, 0); CloseHandle(proc); - return ret; + return ret == -1 ? -1 : pid; } } errno = EINVAL; @@ -207,12 +207,12 @@ quote_arg(const char *arg) return q; } -static pid_t +static intptr_t spawnveq(int mode, const char *path, const char *const *argv, const char *const *env) { char **new_argv; int i, argc = 0; - pid_t ret; + intptr_t ret; if (!argv) { const char *empty_argv[] = { path, NULL }; @@ -235,7 +235,7 @@ spawnveq(int mode, const char *path, const char *const *argv, const char *const return ret; } -pid_t +static intptr_t mingw_spawn_applet(int mode, const char *applet, const char *const *argv, @@ -243,7 +243,7 @@ mingw_spawn_applet(int mode, { char **env = copy_environ(envp); char path[MAX_PATH+20]; - int ret; + intptr_t ret; sprintf(path, "BUSYBOX_APPLET_NAME=%s", applet); env = env_setenv(env, path); @@ -252,10 +252,10 @@ mingw_spawn_applet(int mode, return ret; } -static pid_t +static intptr_t mingw_spawn_interpreter(int mode, const char *prog, const char *const *argv, const char *const *envp) { - int ret; + intptr_t ret; char **opts; int nopts; const char *interpr = parse_interpreter(prog, &opts, &nopts); @@ -296,10 +296,10 @@ mingw_spawn_interpreter(int mode, const char *prog, const char *const *argv, con return ret; } -pid_t +static intptr_t mingw_spawn_1(int mode, const char *cmd, const char *const *argv, const char *const *envp) { - int ret; + intptr_t ret; if (ENABLE_FEATURE_PREFER_APPLETS && find_applet_by_name(cmd) >= 0) -- cgit v1.2.3-55-g6feb