Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit Don't clear the handle to el "sel" and set it ea...



details:   https://anonhg.NetBSD.org/src/rev/c2337a572ec2
branches:  trunk
changeset: 373335:c2337a572ec2
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Feb 03 19:47:38 2023 +0000

description:
Don't clear the handle to el "sel" and set it earlier to prevent handling
a signal before the handle is set. (From: des at FreeBSD)

diffstat:

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

diffs (42 lines):

diff -r a464581d3ed2 -r c2337a572ec2 lib/libedit/sig.c
--- a/lib/libedit/sig.c Fri Feb 03 19:01:08 2023 +0000
+++ b/lib/libedit/sig.c Fri Feb 03 19:47:38 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sig.c,v 1.26 2016/05/09 21:46:56 christos Exp $        */
+/*     $NetBSD: sig.c,v 1.27 2023/02/03 19:47:38 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.26 2016/05/09 21:46:56 christos Exp $");
+__RCSID("$NetBSD: sig.c,v 1.27 2023/02/03 19:47:38 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -170,6 +170,7 @@
        nsa.sa_flags = 0;
        sigemptyset(&nsa.sa_mask);
 
+       sel = el;
        (void) sigprocmask(SIG_BLOCK, &el->el_signal->sig_set, &oset);
 
        for (i = 0; sighdl[i] != -1; i++) {
@@ -178,7 +179,6 @@
                    osa.sa_handler != sig_handler)
                        el->el_signal->sig_action[i] = osa;
        }
-       sel = el;
        (void) sigprocmask(SIG_SETMASK, &oset, NULL);
 }
 
@@ -199,7 +199,5 @@
                        (void)sigaction(sighdl[i],
                            &el->el_signal->sig_action[i], NULL);
 
-       sel = NULL;             /* we are going to die if the handler is
-                                * called */
        (void)sigprocmask(SIG_SETMASK, &oset, NULL);
 }



Home | Main Index | Thread Index | Old Index