Module Name:    src
Committed By:   christos
Date:           Fri Feb  3 19:47:39 UTC 2023

Modified Files:
        src/lib/libedit: sig.c

Log Message:
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)


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libedit/sig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libedit/sig.c
diff -u src/lib/libedit/sig.c:1.26 src/lib/libedit/sig.c:1.27
--- src/lib/libedit/sig.c:1.26	Mon May  9 17:46:56 2016
+++ src/lib/libedit/sig.c	Fri Feb  3 14:47:38 2023
@@ -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 @@ sig_set(EditLine *el)
 	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 @@ sig_set(EditLine *el)
 		    osa.sa_handler != sig_handler)
 			el->el_signal->sig_action[i] = osa;
 	}
-	sel = el;
 	(void) sigprocmask(SIG_SETMASK, &oset, NULL);
 }
 
@@ -199,7 +199,5 @@ sig_clr(EditLine *el)
 			(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);
 }

Reply via email to