diff options
Diffstat (limited to 'lib/execute.c')
-rw-r--r-- | lib/execute.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/execute.c b/lib/execute.c index 5821e82877..bdc0c0c016 100644 --- a/lib/execute.c +++ b/lib/execute.c @@ -97,7 +97,7 @@ nonintr_open (const char *pathname, int oflag, mode_t mode) int execute (const char *progname, - const char *prog_path, char **prog_argv, + const char *prog_path, const char * const *prog_argv, const char *directory, bool ignore_sigpipe, bool null_stdin, bool null_stdout, bool null_stderr, @@ -158,10 +158,10 @@ execute (const char *progname, /* Native Windows API. */ - char *prog_argv_mem_to_free; + char *argv_mem_to_free; - prog_argv = prepare_spawn (prog_argv, &prog_argv_mem_to_free); - if (prog_argv == NULL) + const char **argv = prepare_spawn (prog_argv, &argv_mem_to_free); + if (argv == NULL) xalloc_die (); int exitcode = -1; @@ -188,17 +188,17 @@ execute (const char *progname, HANDLE stderr_handle = (HANDLE) _get_osfhandle (null_stderr ? nulloutfd : STDERR_FILENO); - exitcode = spawnpvech (P_WAIT, prog_path, (const char **) (prog_argv + 1), - (const char **) environ, directory, + exitcode = spawnpvech (P_WAIT, prog_path, argv + 1, + (const char * const *) environ, directory, stdin_handle, stdout_handle, stderr_handle); if (exitcode == -1 && errno == ENOEXEC) { /* prog is not a native executable. Try to execute it as a shell script. Note that prepare_spawn() has already prepended - a hidden element "sh.exe" to prog_argv. */ - prog_argv[1] = prog_path; - exitcode = spawnpvech (P_WAIT, prog_argv[0], (const char **) prog_argv, - (const char **) environ, directory, + a hidden element "sh.exe" to argv. */ + argv[1] = prog_path; + exitcode = spawnpvech (P_WAIT, argv[0], argv, + (const char * const *) environ, directory, stdin_handle, stdout_handle, stderr_handle); } } @@ -208,8 +208,8 @@ execute (const char *progname, close (nulloutfd); if (nullinfd >= 0) close (nullinfd); - free (prog_argv); - free (prog_argv_mem_to_free); + free (argv); + free (argv_mem_to_free); free (prog_path_to_free); if (termsigp != NULL) @@ -277,11 +277,11 @@ execute (const char *progname, != 0))) || (err = (directory != NULL ? posix_spawn (&child, prog_path, &actions, - attrs_allocated ? &attrs : NULL, prog_argv, - environ) + attrs_allocated ? &attrs : NULL, + (char * const *) prog_argv, environ) : posix_spawnp (&child, prog_path, &actions, - attrs_allocated ? &attrs : NULL, prog_argv, - environ))) + attrs_allocated ? &attrs : NULL, + (char * const *) prog_argv, environ))) != 0)) { if (actions_allocated) |