summaryrefslogtreecommitdiff
path: root/usr.bin/sendbug/sendbug.c
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2007-05-06 04:50:27 +0000
committerRay Lai <ray@cvs.openbsd.org>2007-05-06 04:50:27 +0000
commit3f21977d59831078de222df18ae9a52da3234d23 (patch)
tree141deaee9037fc76cfde0b80de06d19f4fb959fb /usr.bin/sendbug/sendbug.c
parentac2ee800bea303b469377210852de6af399d82f1 (diff)
Save and restore signals once instead of each time fork fails with
EAGAIN.
Diffstat (limited to 'usr.bin/sendbug/sendbug.c')
-rw-r--r--usr.bin/sendbug/sendbug.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/sendbug/sendbug.c b/usr.bin/sendbug/sendbug.c
index 5cb53f8250c..1431f7fe2a2 100644
--- a/usr.bin/sendbug/sendbug.c
+++ b/usr.bin/sendbug/sendbug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sendbug.c,v 1.43 2007/04/25 04:56:14 ray Exp $ */
+/* $OpenBSD: sendbug.c,v 1.44 2007/05/06 04:50:26 ray Exp $ */
/*
* Written by Ray Lai <ray@cyth.net>.
@@ -238,20 +238,20 @@ editit(const char *pathname)
return (-1);
argp[2] = p;
- top:
sighup = signal(SIGHUP, SIG_IGN);
sigint = signal(SIGINT, SIG_IGN);
sigquit = signal(SIGQUIT, SIG_IGN);
+ top:
if ((pid = fork()) == -1) {
int saved_errno = errno;
- (void)signal(SIGHUP, sighup);
- (void)signal(SIGINT, sigint);
- (void)signal(SIGQUIT, sigquit);
if (saved_errno == EAGAIN) {
sleep(1);
goto top;
}
+ (void)signal(SIGHUP, sighup);
+ (void)signal(SIGINT, sigint);
+ (void)signal(SIGQUIT, sigquit);
free(p);
errno = saved_errno;
return (-1);