broadcast: fix compiler warnings
Newer gcc reports: broadcast.c: In function 'broadcast': broadcast.c:132:15: warning: variable 'tp' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] 132 | FILE *tp; Move the storage off the stack to avoid. This makes the function not safe for multithread use, but we don't do that anywhere, so who cares!
This commit is contained in:
parent
8ffc4162e2
commit
8b247dd5d8
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user