mirror of
https://github.com/mirror/make.git
synced 2025-01-28 05:10:24 +08:00
Remove use of vfork().
GCC was giving us warnings, most OS's now just run fork() when you call vfork(), and looking at the standard definition of vfork() we are a long way from using it safely anyway: you're not allowed to even call a function before you exec().
This commit is contained in:
parent
7c77486d1f
commit
94735f0ad7
@ -109,9 +109,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
||||||
/* #undef HAVE_UTIME_NULL */
|
/* #undef HAVE_UTIME_NULL */
|
||||||
|
|
||||||
/* Define if you have <vfork.h>. */
|
|
||||||
/* #undef HAVE_VFORK_H */
|
|
||||||
|
|
||||||
/* Define if you have the wait3 system call. */
|
/* Define if you have the wait3 system call. */
|
||||||
/* #undef HAVE_WAIT3 */
|
/* #undef HAVE_WAIT3 */
|
||||||
|
|
||||||
@ -176,9 +173,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
instead of <sys/cpustats.h>. */
|
instead of <sys/cpustats.h>. */
|
||||||
/* #undef UMAX4_3 */
|
/* #undef UMAX4_3 */
|
||||||
|
|
||||||
/* Define vfork as fork if vfork does not work. */
|
|
||||||
/* #undef vfork */
|
|
||||||
|
|
||||||
/* Name of this package (needed by automake) */
|
/* Name of this package (needed by automake) */
|
||||||
#define PACKAGE "%PACKAGE%"
|
#define PACKAGE "%PACKAGE%"
|
||||||
|
|
||||||
|
@ -138,9 +138,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
/* Define to 1 if utime(file, NULL) sets file's timestamp to the present. */
|
/* Define to 1 if utime(file, NULL) sets file's timestamp to the present. */
|
||||||
/* #undef HAVE_UTIME_NULL */
|
/* #undef HAVE_UTIME_NULL */
|
||||||
|
|
||||||
/* Define to 1 if you have <vfork.h>. */
|
|
||||||
/* #undef HAVE_VFORK_H */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the wait3 system call. */
|
/* Define to 1 if you have the wait3 system call. */
|
||||||
/* #undef HAVE_WAIT3 */
|
/* #undef HAVE_WAIT3 */
|
||||||
|
|
||||||
@ -210,9 +207,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
instead of <sys/cpustats.h>. */
|
instead of <sys/cpustats.h>. */
|
||||||
/* #undef UMAX4_3 */
|
/* #undef UMAX4_3 */
|
||||||
|
|
||||||
/* Define vfork as fork if vfork does not work. */
|
|
||||||
/* #undef vfork */
|
|
||||||
|
|
||||||
/* Name of this package (needed by automake) */
|
/* Name of this package (needed by automake) */
|
||||||
#define PACKAGE "%PACKAGE%"
|
#define PACKAGE "%PACKAGE%"
|
||||||
|
|
||||||
|
@ -123,9 +123,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
/* Define to 1 if you have the 'fileno' function. */
|
/* Define to 1 if you have the 'fileno' function. */
|
||||||
#define HAVE_FILENO 1
|
#define HAVE_FILENO 1
|
||||||
|
|
||||||
/* Define to 1 if you have the 'fork' function. */
|
|
||||||
/* #undef HAVE_FORK */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the 'getcwd' function. */
|
/* Define to 1 if you have the 'getcwd' function. */
|
||||||
#define HAVE_GETCWD 1
|
#define HAVE_GETCWD 1
|
||||||
|
|
||||||
@ -339,24 +336,12 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
#define HAVE_UNISTD_H 1
|
#define HAVE_UNISTD_H 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define to 1 if you have the 'vfork' function. */
|
|
||||||
/* #undef HAVE_VFORK */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <vfork.h> header file. */
|
|
||||||
/* #undef HAVE_VFORK_H */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the 'wait3' function. */
|
/* Define to 1 if you have the 'wait3' function. */
|
||||||
/* #undef HAVE_WAIT3 */
|
/* #undef HAVE_WAIT3 */
|
||||||
|
|
||||||
/* Define to 1 if you have the 'waitpid' function. */
|
/* Define to 1 if you have the 'waitpid' function. */
|
||||||
/* #undef HAVE_WAITPID */
|
/* #undef HAVE_WAITPID */
|
||||||
|
|
||||||
/* Define to 1 if 'fork' works. */
|
|
||||||
/* #undef HAVE_WORKING_FORK */
|
|
||||||
|
|
||||||
/* Define to 1 if 'vfork' works. */
|
|
||||||
/* #undef HAVE_WORKING_VFORK */
|
|
||||||
|
|
||||||
/* Build host information. */
|
/* Build host information. */
|
||||||
#define MAKE_HOST "Windows32"
|
#define MAKE_HOST "Windows32"
|
||||||
|
|
||||||
@ -498,9 +483,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
#define uintmax_t unsigned long
|
#define uintmax_t unsigned long
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define as 'fork' if 'vfork' does not work. */
|
|
||||||
/*#define vfork fork*/
|
|
||||||
|
|
||||||
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
/* #undef HAVE_SYS_WAIT_H */
|
/* #undef HAVE_SYS_WAIT_H */
|
||||||
|
|
||||||
|
@ -153,7 +153,6 @@ AC_CHECK_FUNCS([strcasecmp strncasecmp strcmpi strncmpi stricmp strnicmp])
|
|||||||
AC_FUNC_STRCOLL
|
AC_FUNC_STRCOLL
|
||||||
|
|
||||||
AC_FUNC_ALLOCA
|
AC_FUNC_ALLOCA
|
||||||
AC_FUNC_FORK([])
|
|
||||||
AC_FUNC_CLOSEDIR_VOID
|
AC_FUNC_CLOSEDIR_VOID
|
||||||
|
|
||||||
# See if the user wants to add (or not) GNU Guile support
|
# See if the user wants to add (or not) GNU Guile support
|
||||||
|
9
job.c
9
job.c
@ -1380,9 +1380,8 @@ start_job_command (struct child *child)
|
|||||||
#endif
|
#endif
|
||||||
int print_cmd;
|
int print_cmd;
|
||||||
int sync_cmd;
|
int sync_cmd;
|
||||||
|
int flags;
|
||||||
char *p;
|
char *p;
|
||||||
/* Must be volatile to silence bogus GCC warning about longjmp/vfork. */
|
|
||||||
volatile int flags;
|
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
char *argv;
|
char *argv;
|
||||||
#else
|
#else
|
||||||
@ -1677,7 +1676,7 @@ start_job_command (struct child *child)
|
|||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
if (!child_execute_job (argv, child)) {
|
if (!child_execute_job (argv, child)) {
|
||||||
/* Fork failed! */
|
/* Fork failed! */
|
||||||
perror_with_name ("vfork", "");
|
perror_with_name ("fork", "");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1718,7 +1717,7 @@ start_job_command (struct child *child)
|
|||||||
|
|
||||||
#else /* !__EMX__ */
|
#else /* !__EMX__ */
|
||||||
|
|
||||||
child->pid = vfork ();
|
child->pid = fork ();
|
||||||
environ = parent_environ; /* Restore value child may have clobbered. */
|
environ = parent_environ; /* Restore value child may have clobbered. */
|
||||||
if (child->pid == 0)
|
if (child->pid == 0)
|
||||||
{
|
{
|
||||||
@ -1764,7 +1763,7 @@ start_job_command (struct child *child)
|
|||||||
{
|
{
|
||||||
/* Fork failed! */
|
/* Fork failed! */
|
||||||
unblock_sigs ();
|
unblock_sigs ();
|
||||||
perror_with_name ("vfork", "");
|
perror_with_name ("fork", "");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
# endif /* !__EMX__ */
|
# endif /* !__EMX__ */
|
||||||
|
@ -492,10 +492,6 @@ typedef int (*load_func_t)(const gmk_floc *flocp);
|
|||||||
int load_file (const gmk_floc *flocp, const char **filename, int noerror,
|
int load_file (const gmk_floc *flocp, const char **filename, int noerror,
|
||||||
void **dlp);
|
void **dlp);
|
||||||
|
|
||||||
#ifdef HAVE_VFORK_H
|
|
||||||
# include <vfork.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We omit these declarations on non-POSIX systems which define _POSIX_VERSION,
|
/* We omit these declarations on non-POSIX systems which define _POSIX_VERSION,
|
||||||
because such systems often declare them in header files anyway. */
|
because such systems often declare them in header files anyway. */
|
||||||
|
|
||||||
|
@ -221,11 +221,11 @@ start_remote_job (char **argv, char **envp, int stdin_fd,
|
|||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
fflush (stderr);
|
fflush (stderr);
|
||||||
|
|
||||||
pid = vfork ();
|
pid = fork ();
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
{
|
{
|
||||||
/* The fork failed! */
|
/* The fork failed! */
|
||||||
perror_with_name ("vfork", "");
|
perror_with_name ("fork", "");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (pid == 0)
|
else if (pid == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user