From e9228802a977c5de4f37de259912585f0b97d791 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 3 Jun 2011 06:52:38 +0000 Subject: protect errno from damage in the signal handler ok otto --- usr.bin/bc/bc.y | 5 +++-- 1 file 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 @@ -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 * -- cgit v1.2.3