mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
Fall back to execve/wait when execvp and waitpid are unavailable.
This commit is contained in:
parent
ceea60059a
commit
358ea4ef9a
2 changed files with 12 additions and 3 deletions
|
@ -10,11 +10,11 @@ AC_FUNC_VPRINTF
|
|||
AC_FUNC_VA_COPY
|
||||
AC_FUNC__VA_COPY
|
||||
AC_CHECK_FUNCS(
|
||||
access _access connect dlopen fcntl ftime _ftime getaddrinfo \
|
||||
access _access connect dlopen execvp fcntl ftime _ftime getaddrinfo \
|
||||
gethostbyname gethostname getnameinfo getpagesize gettimeofday getuid \
|
||||
getwd ioctl mkdir _mkdir mprotect putenv select snprintf _snprintf \
|
||||
socket stat strcasestr strerror strnlen strsep strstr vsnprintf \
|
||||
_vsnprintf
|
||||
_vsnprintf wait
|
||||
)
|
||||
|
||||
DL_LIBS=""
|
||||
|
|
|
@ -259,7 +259,11 @@ preprocess_file (const char *filename, const char *ext)
|
|||
printf ("%s ", *a);
|
||||
puts("");
|
||||
}
|
||||
#ifdef HAVE_EXECVP
|
||||
execvp (cpp_argv[0], (char **)cpp_argv);
|
||||
#else
|
||||
execve (cpp_argv[0], (char **)cpp_argv, environ);
|
||||
#endif
|
||||
perror (cpp_argv[0]);
|
||||
exit (1);
|
||||
} else {
|
||||
|
@ -268,7 +272,12 @@ preprocess_file (const char *filename, const char *ext)
|
|||
pid_t rc;
|
||||
|
||||
// printf ("pid = %d\n", pid);
|
||||
if ((rc = waitpid (0, &status, 0 | WUNTRACED)) != pid) {
|
||||
#ifdef HAVE_WAITPID
|
||||
rc = waitpid (0, &status, 0 | WUNTRACED);
|
||||
#else
|
||||
rc = wait (&status);
|
||||
#endif
|
||||
if ((rc) != pid) {
|
||||
if (rc == -1) {
|
||||
perror ("wait");
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue