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)
This commit is contained in:
parent
dae3cea673
commit
0428f1e1b1
|
@ -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
|
* Copyright (c) 1992, 1993
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)sig.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)sig.c 8.1 (Berkeley) 6/4/93";
|
||||||
#else
|
#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
|
||||||
#endif /* not lint && not SCCSID */
|
#endif /* not lint && not SCCSID */
|
||||||
|
|
||||||
|
@ -170,6 +170,7 @@ sig_set(EditLine *el)
|
||||||
nsa.sa_flags = 0;
|
nsa.sa_flags = 0;
|
||||||
sigemptyset(&nsa.sa_mask);
|
sigemptyset(&nsa.sa_mask);
|
||||||
|
|
||||||
|
sel = el;
|
||||||
(void) sigprocmask(SIG_BLOCK, &el->el_signal->sig_set, &oset);
|
(void) sigprocmask(SIG_BLOCK, &el->el_signal->sig_set, &oset);
|
||||||
|
|
||||||
for (i = 0; sighdl[i] != -1; i++) {
|
for (i = 0; sighdl[i] != -1; i++) {
|
||||||
|
@ -178,7 +179,6 @@ sig_set(EditLine *el)
|
||||||
osa.sa_handler != sig_handler)
|
osa.sa_handler != sig_handler)
|
||||||
el->el_signal->sig_action[i] = osa;
|
el->el_signal->sig_action[i] = osa;
|
||||||
}
|
}
|
||||||
sel = el;
|
|
||||||
(void) sigprocmask(SIG_SETMASK, &oset, NULL);
|
(void) sigprocmask(SIG_SETMASK, &oset, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +199,5 @@ sig_clr(EditLine *el)
|
||||||
(void)sigaction(sighdl[i],
|
(void)sigaction(sighdl[i],
|
||||||
&el->el_signal->sig_action[i], NULL);
|
&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);
|
(void)sigprocmask(SIG_SETMASK, &oset, NULL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue