@matheusbsbs / matheus-bagliano / commits / 5debf9a5ac
Fork 0

Add MinGW-specific execv() override.

As of 2dbc887e, shell.c employs execv(), so provide a MinGW-specific mingw_execv() override, complementing existing mingw_execvp() and cousins. As a bonus, this also resolves a compilation warning due to an execv() prototype mismatch between Linux and MinGW. Linux expects the second argument to be (char *const *), whereas MinGW expects (const char *const *). Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Eric Sunshine committed Sep 27, 2010 at 07:02 UTC 5debf9a5ac89e9ba49dedc960078cf22bba25c50
2 files changed +7
compat/mingw.c
+5
@@ -904,6 +904,11 @@ void mingw_execvp(const char *cmd, char *const *argv)
904 free_path_split(path);
905 }
906
907 +void mingw_execv(const char *cmd, char *const *argv)
908 +{
909 + mingw_execve(cmd, argv, environ);
910 +}
911 +
912 static char **copy_environ(void)
913 {
914 char **env;
compat/mingw.h
+2
@@ -256,6 +256,8 @@ pid_t mingw_spawnvpe(const char *cmd, const char **argv, char **env,
256 int fhin, int fhout, int fherr);
257 void mingw_execvp(const char *cmd, char *const *argv);
258 #define execvp mingw_execvp
259 +void mingw_execv(const char *cmd, char *const *argv);
260 +#define execv mingw_execv
261
262 static inline unsigned int git_ntohl(unsigned int x)
263 { return (unsigned int)ntohl(x); }