summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2011-06-03 06:52:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2011-06-03 06:52:38 +0000
commite9228802a977c5de4f37de259912585f0b97d791 (patch)
treec2e8d0b235ba9b0cbcc0a22e5e97e785660938f9
parentd0623598b772776507659254cf9b94adee6d9f4e (diff)
protect errno from damage in the signal handler
ok otto
-rw-r--r--usr.bin/bc/bc.y5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/bc/bc.y b/usr.bin/bc/bc.y
index b1ee4e467df..cd27e1720af 100644
--- a/usr.bin/bc/bc.y
+++ b/usr.bin/bc/bc.y
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: bc.y,v 1.36 2011/06/03 06:10:31 otto Exp $ */
+/* $OpenBSD: bc.y,v 1.37 2011/06/03 06:52:37 deraadt Exp $ */
/*
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
@@ -1058,7 +1058,7 @@ void
sigchld(int signo)
{
pid_t pid;
- int status;
+ int status, save_errno = errno;
for (;;) {
pid = waitpid(dc, &status, WCONTINUED);
@@ -1072,6 +1072,7 @@ sigchld(int signo)
else
break;
}
+ errno = save_errno;
}
static const char *