Set restore point before setting signal handlers

This commit is contained in:
Roberto E. Vargas Caballero 2018-03-04 11:58:07 +01:00 committed by sin
parent d098ac4abc
commit 651e2b0ee2
1 changed files with 6 additions and 8 deletions

14
ed.c
View File

@ -1368,7 +1368,6 @@ sighup(int dummy)
static void
edit(void)
{
setjmp(savesp);
for (;;) {
newcmd = 1;
ocurln = curln;
@ -1388,8 +1387,6 @@ init(char *fname)
{
size_t len;
if (setjmp(savesp))
return;
setscratch();
if (!fname)
return;
@ -1418,11 +1415,12 @@ main(int argc, char *argv[])
if (argc > 1)
usage();
signal(SIGINT, sigintr);
signal(SIGHUP, sighup);
signal(SIGQUIT, SIG_IGN);
init(*argv);
if (!setjmp(savesp)) {
signal(SIGINT, sigintr);
signal(SIGHUP, sighup);
signal(SIGQUIT, SIG_IGN);
init(*argv);
}
edit();
/* not reached */