summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2011-06-03 06:52:37 +0000
committerderaadt <deraadt@openbsd.org>2011-06-03 06:52:37 +0000
commit87eeae219b05a8ecb5f1ec5616eec60e01847e17 (patch)
tree947da87de34ddfa6e0c8d9a2400c4cec0503d2a7
parentMake ^D behave: dont't echo it and make it work if the cursor is at (diff)
downloadwireguard-openbsd-87eeae219b05a8ecb5f1ec5616eec60e01847e17.tar.xz
wireguard-openbsd-87eeae219b05a8ecb5f1ec5616eec60e01847e17.zip
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 *