* src/misc.c (make_pid): A function to return the PID

* src/makeint.h: Declare it.
* src/commands.c (fatal_error_signal): Call it.
This commit is contained in:
Paul Smith 2022-06-04 16:48:26 -04:00
parent 1c179f9636
commit d444b87173
3 changed files with 12 additions and 5 deletions

View File

@ -30,10 +30,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#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 */

View File

@ -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);

View File

@ -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. */