aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rc/broadcast.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rc/broadcast.c b/src/rc/broadcast.c
index d9eb7240..402a9fb9 100644
--- a/src/rc/broadcast.c
+++ b/src/rc/broadcast.c
@@ -117,6 +117,8 @@ static int file_isatty(const char *fname)
/*
* broadcast function.
+ *
+ * NB: Not multithread safe.
*/
void broadcast(char *text)
{
@@ -128,11 +130,15 @@ void broadcast(char *text)
char *p;
char *line = NULL;
struct sigaction sa;
- volatile int fd;
- FILE *tp;
int flags;
char *term = NULL;
struct utmpx *utmp;
+ /*
+ * These are set across the sigsetjmp call, so they can't be stored on
+ * the stack, otherwise they might be clobbered.
+ */
+ static int fd;
+ static FILE *tp;
getuidtty(&user, &tty);