From cf1c89a6efbf6d1089dc45629e2c43563cb67601 Mon Sep 17 00:00:00 2001 From: Ray Lai Date: Sun, 25 Mar 2007 23:18:57 +0000 Subject: Save errno before calling signal(). --- usr.bin/sendbug/sendbug.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/sendbug/sendbug.c b/usr.bin/sendbug/sendbug.c index d0af34cc752..4a03d2233e6 100644 --- a/usr.bin/sendbug/sendbug.c +++ b/usr.bin/sendbug/sendbug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sendbug.c,v 1.15 2007/03/23 17:18:07 deraadt Exp $ */ +/* $OpenBSD: sendbug.c,v 1.16 2007/03/25 23:18:56 ray Exp $ */ /* * Written by Ray Lai . @@ -187,15 +187,17 @@ editit(char *tmpfile) (void)signal(SIGINT, SIG_IGN); (void)signal(SIGQUIT, SIG_IGN); if ((pid = fork()) < 0) { + int saved_errno = errno; + (void)signal(SIGHUP, SIG_DFL); (void)signal(SIGINT, SIG_DFL); (void)signal(SIGQUIT, SIG_DFL); - if (errno == EPROCLIM) { + if (saved_errno == EPROCLIM) { warnx("you have too many processes"); free(p); return(0); } - if (errno == EAGAIN) { + if (saved_errno == EAGAIN) { sleep(1); goto top; } -- cgit v1.2.3