diff --git a/src/commands.c b/src/commands.c index cef51d35..c048004b 100644 --- a/src/commands.c +++ b/src/commands.c @@ -30,10 +30,6 @@ this program. If not, see . */ #else # define FILE_LIST_SEPARATOR ' ' #endif - -#ifndef HAVE_UNISTD_H -pid_t getpid (); -#endif static unsigned long @@ -599,7 +595,7 @@ fatal_error_signal (int sig) #else /* Signal the same code; this time it will really be fatal. The signal will be unblocked when we return and arrive then to kill us. */ - if (kill (getpid (), sig) < 0) + if (kill (make_pid (), sig) < 0) pfatal_with_name ("kill"); #endif /* not WINDOWS32 */ #endif /* not Amiga */ diff --git a/src/makeint.h b/src/makeint.h index fce1afe1..6bcb0c2c 100644 --- a/src/makeint.h +++ b/src/makeint.h @@ -541,6 +541,7 @@ void die (int) NORETURN; void pfatal_with_name (const char *) NORETURN; void perror_with_name (const char *, const char *); #define xstrlen(_s) ((_s)==NULL ? 0 : strlen (_s)) +pid_t make_pid (); void *xmalloc (size_t); void *xcalloc (size_t); void *xrealloc (void *, size_t); diff --git a/src/misc.c b/src/misc.c index 4f6bbf85..b03f2a3a 100644 --- a/src/misc.c +++ b/src/misc.c @@ -173,6 +173,16 @@ concat (unsigned int num, ...) return result; } + +#ifndef HAVE_UNISTD_H +pid_t getpid (); +#endif + +pid_t make_pid () +{ + return getpid (); +} + /* Like malloc but get fatal error if memory is exhausted. */ /* Don't bother if we're using dmalloc; it provides these for us. */