Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libedit OpenBSD sig.c rev. 1.6 2001/12/06 04:26:00 deraadt



details:   https://anonhg.NetBSD.org/src/rev/d39d1f5466f9
branches:  trunk
changeset: 813719:d39d1f5466f9
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Feb 15 15:29:25 2016 +0000

description:
OpenBSD sig.c rev. 1.6 2001/12/06 04:26:00 deraadt
save and restore errno in signal handler

diffstat:

 lib/libedit/sig.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r d925a82300f5 -r d39d1f5466f9 lib/libedit/sig.c
--- a/lib/libedit/sig.c Mon Feb 15 15:26:48 2016 +0000
+++ b/lib/libedit/sig.c Mon Feb 15 15:29:25 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sig.c,v 1.17 2011/07/28 20:50:55 christos Exp $        */
+/*     $NetBSD: sig.c,v 1.18 2016/02/15 15:29:25 christos Exp $        */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)sig.c      8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: sig.c,v 1.17 2011/07/28 20:50:55 christos Exp $");
+__RCSID("$NetBSD: sig.c,v 1.18 2016/02/15 15:29:25 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -68,9 +68,10 @@
 private void
 sig_handler(int signo)
 {
-       int i;
+       int i, save_errno;
        sigset_t nset, oset;
 
+       save_errno = errno;
        (void) sigemptyset(&nset);
        (void) sigaddset(&nset, signo);
        (void) sigprocmask(SIG_BLOCK, &nset, &oset);
@@ -104,6 +105,7 @@
        sigemptyset(&sel->el_signal->sig_action[i].sa_mask);
        (void) sigprocmask(SIG_SETMASK, &oset, NULL);
        (void) kill(0, signo);
+       errno = save_errno;
 }
 
 



Home | Main Index | Thread Index | Old Index