diff options
author | Ramsay Jones <ramsay@ramsay1.demon.co.uk> | 2012-04-05 18:48:46 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-04-05 16:22:48 -0700 |
commit | 1696d72321492c05bebd1e823de0708c13ec7d72 (patch) | |
tree | 6621bb4ea1ed488c81665975dc21ff454a501b2d /compat/mingw.c | |
parent | 828ea97de486c1693d6e4f2c7347acb50235a85d (diff) | |
download | git-1696d72321492c05bebd1e823de0708c13ec7d72.tar.gz |
compat/mingw.[ch]: Change return type of exec functions to int
The POSIX standard specifies a return type of int for all six exec
functions. In addition, all exec functions return -1 on error, and
simply do not return on success. However, the current emulation of
the exec functions on mingw are declared with a void return type.
This would cause a problem should any code attempt to call the
exec function in a non-void context. In particular, if an exec
function were used in a conditional it would fail to compile.
In order to improve the fidelity of the emulation, we change the
return type of the mingw_execv[p] functions to int and return -1
on error.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/mingw.c')
-rw-r--r-- | compat/mingw.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compat/mingw.c b/compat/mingw.c index a0ac487c0c..afc892d6b1 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1003,7 +1003,7 @@ static void mingw_execve(const char *cmd, char *const *argv, char *const *env) } } -void mingw_execvp(const char *cmd, char *const *argv) +int mingw_execvp(const char *cmd, char *const *argv) { char **path = get_path_split(); char *prog = path_lookup(cmd, path, 0); @@ -1015,11 +1015,13 @@ void mingw_execvp(const char *cmd, char *const *argv) errno = ENOENT; free_path_split(path); + return -1; } -void mingw_execv(const char *cmd, char *const *argv) +int mingw_execv(const char *cmd, char *const *argv) { mingw_execve(cmd, argv, environ); + return -1; } int mingw_kill(pid_t pid, int sig) |