summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Insulander <hin@cvs.openbsd.org>2002-03-25 10:52:33 +0000
committerHans Insulander <hin@cvs.openbsd.org>2002-03-25 10:52:33 +0000
commitf8f7416f292483435c9c89e58d47df145bbb7728 (patch)
tree90b26cb9cd99eb4f20af89f511d6036e3670c278
parent573269ef0f76282c210c809b1e36479e5d1aa9d3 (diff)
Todd Miller pointed this out to me:
You really want to use 'volatile sig_atomic_t' not just sig_atomic_t for flags set in signal handlers. Without the volatile gcc may stick the value in a register but update the on-stack copy in the signal handler.
-rw-r--r--usr.bin/telnet/externs.h4
-rw-r--r--usr.bin/telnet/sys_bsd.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/telnet/externs.h b/usr.bin/telnet/externs.h
index a6e2bab6f4c..a4ada49930b 100644
--- a/usr.bin/telnet/externs.h
+++ b/usr.bin/telnet/externs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: externs.h,v 1.9 2002/03/22 13:49:28 hin Exp $ */
+/* $OpenBSD: externs.h,v 1.10 2002/03/25 10:52:32 hin Exp $ */
/* $KTH: externs.h,v 1.16 1997/11/29 02:28:35 joda Exp $ */
/*
@@ -88,7 +88,7 @@ extern int
termdata, /* Print out terminal data flow */
debug; /* Debug level */
-extern sig_atomic_t intr_happened, intr_waiting; /* for interrupt handling */
+extern volatile sig_atomic_t intr_happened, intr_waiting; /* for interrupt handling */
extern cc_t escape; /* Escape to command mode */
extern cc_t rlogin; /* Rlogin mode escape character */
diff --git a/usr.bin/telnet/sys_bsd.c b/usr.bin/telnet/sys_bsd.c
index 0d83dcbf6c2..af85d4931ed 100644
--- a/usr.bin/telnet/sys_bsd.c
+++ b/usr.bin/telnet/sys_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_bsd.c,v 1.11 2002/03/22 13:49:28 hin Exp $ */
+/* $OpenBSD: sys_bsd.c,v 1.12 2002/03/25 10:52:32 hin Exp $ */
/* $NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp $ */
/*
@@ -844,8 +844,8 @@ deadpeer(sig)
longjmp(peerdied, -1);
}
-sig_atomic_t intr_happened = 0;
-sig_atomic_t intr_waiting = 0;
+volatile sig_atomic_t intr_happened = 0;
+volatile sig_atomic_t intr_waiting = 0;
/* ARGSUSED */
void