summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel van Smoorenburg <miquels@debian.org>2016-11-11 07:07:17 -0800
committerMiquel van Smoorenburg <miquels@debian.org>2016-11-11 07:07:17 -0800
commit95d34d42a029a3635a35fda4729bb7db0d200a8a (patch)
treec47424b1e9c12ee56479d35c7f43abf849058a95
parent7a7f22d47fe5dfa77ada9cc889638cd6bfcd9df3 (diff)
patch-siglongjmp
setjmp/longjmp are used to jump out of signal handlers. That causes weirdness. Use sigsetjmp/siglongjmp. Gbp-Pq: Name patch-siglongjmp.diff
-rw-r--r--main.c6
-rw-r--r--tio.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/main.c b/main.c
index 781c8be..25213df 100644
--- a/main.c
+++ b/main.c
@@ -20,7 +20,7 @@
extern trapint(); /* defined below */
extern char *getenv();
-jmp_buf jmpenv;
+sigjmp_buf jmpenv;
#ifndef NO_DIGRAPH
static init_digraphs();
@@ -310,7 +310,7 @@ int main(argc, argv)
*/
while (mode != MODE_QUIT)
{
- if (setjmp(jmpenv))
+ if (sigsetjmp(jmpenv, 1))
{
/* Maybe we just aborted a change? */
abortdo();
@@ -371,7 +371,7 @@ int trapint(signo)
#else
signal(signo, trapint);
#endif
- longjmp(jmpenv, 1);
+ siglongjmp(jmpenv, 1);
return 0;
}
diff --git a/tio.c b/tio.c
index c010da1..8b60802 100644
--- a/tio.c
+++ b/tio.c
@@ -350,10 +350,10 @@ static struct _keymap
#if !MSDOS && !TOS
# if BSD || COHERENT
-static jmp_buf env_timeout;
+static sigjmp_buf env_timeout;
static int dummy()
{
- longjmp(env_timeout, 1);
+ siglongjmp(env_timeout, 1);
return 0;
}
# else
@@ -552,7 +552,7 @@ int getkey(when)
while (j > 1)
{
#if BSD || COHERENT
- if (setjmp(env_timeout))
+ if (sigsetjmp(env_timeout, 1))
{
/* we timed out - assume no mapping */
j = 0;