From: Bruno Haible Date: Fri, 6 Mar 2009 14:39:33 +0000 (+0100) Subject: Avoid errors from posix_spawn on platforms where it is not yet ported to. X-Git-Tag: v0.1~6217 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=883b9007b919bce1c06e030c28220aeee2a825fc;p=gnulib.git Avoid errors from posix_spawn on platforms where it is not yet ported to. --- diff --git a/ChangeLog b/ChangeLog index 78ca71b2f..0ce35d029 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,15 @@ 2009-03-06 Eric Blake + Bruno Haible + + * lib/spawni.c (__spawni) [WIN32_NATIVE]: Define as a stub. + * modules/posix_spawn-tests (configure.ac): Define POSIX_SPAWN_PORTED + condition. + (Makefile.am): Do nothing if POSIX_SPAWN_PORTED is false. + * modules/posix_spawnp-tests (configure.ac): Define POSIX_SPAWN_PORTED + condition. + (Makefile.am): Do nothing if POSIX_SPAWN_PORTED is false. + +2009-03-06 Eric Blake * lib/execute.c (execute) [WIN32_NATIVE]: Cast arguments of spawnvpe, to avoid compiler warnings. diff --git a/lib/spawni.c b/lib/spawni.c index ea6555333..484a50ba3 100644 --- a/lib/spawni.c +++ b/lib/spawni.c @@ -1,5 +1,5 @@ /* Guts of POSIX spawn interface. Generic POSIX.1 version. - Copyright (C) 2000-2005, 2006, 2008 Free Software Foundation, Inc. + Copyright (C) 2000-2006, 2008-2009 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -89,6 +89,22 @@ #define SPAWN_ERROR 127 +#if defined _MSC_VER || defined __MINGW32__ + +/* Native Woe32 API. */ +int +__spawni (pid_t *pid, const char *file, + const posix_spawn_file_actions_t *file_actions, + const posix_spawnattr_t *attrp, char *const argv[], + char *const envp[], int use_path) +{ + /* Not yet implemented. */ + return ENOSYS; +} + +#else + + /* The file is accessible but it is not an executable file. Invoke the shell to interpret it as a script. */ static void @@ -354,3 +370,5 @@ __spawni (pid_t *pid, const char *file, /* Return with an error. */ _exit (SPAWN_ERROR); } + +#endif diff --git a/modules/posix_spawn-tests b/modules/posix_spawn-tests index b34ea1d3d..fc62cea81 100644 --- a/modules/posix_spawn-tests +++ b/modules/posix_spawn-tests @@ -10,7 +10,17 @@ unistd sys_wait configure.ac: +AC_EGREP_CPP([notposix], [[ +#if defined _MSC_VER || defined __MINGW32__ + notposix +#endif + ]], + [posix_spawn_ported=no], + [posix_spawn_ported=yes]) +AM_CONDITIONAL([POSIX_SPAWN_PORTED], [test $posix_spawn_ported = yes]) Makefile.am: +if POSIX_SPAWN_PORTED TESTS += test-posix_spawn3 check_PROGRAMS += test-posix_spawn3 +endif diff --git a/modules/posix_spawnp-tests b/modules/posix_spawnp-tests index 7c045800f..f8c7233f7 100644 --- a/modules/posix_spawnp-tests +++ b/modules/posix_spawnp-tests @@ -20,8 +20,17 @@ unistd sys_wait configure.ac: +AC_EGREP_CPP([notposix], [[ +#if defined _MSC_VER || defined __MINGW32__ + notposix +#endif + ]], + [posix_spawn_ported=no], + [posix_spawn_ported=yes]) +AM_CONDITIONAL([POSIX_SPAWN_PORTED], [test $posix_spawn_ported = yes]) Makefile.am: +if POSIX_SPAWN_PORTED TESTS += test-posix_spawn1 test-posix_spawn2 check_PROGRAMS += test-posix_spawn1 test-posix_spawn2 @@ -36,3 +45,4 @@ test-posix_spawn2.sh: test-posix_spawn2.in.sh cp $(srcdir)/test-posix_spawn2.in.sh $@-t mv $@-t $@ MOSTLYCLEANFILES += test-posix_spawn2.sh test-posix_spawn2.sh-t +endif