Get rid of warning about unused argument fromshutdown, and make sure the wall string isn't changed by the wall() function.

This commit is contained in:
Petter Reinholdtsen 2009-11-22 22:05:53 +00:00
parent 093ad0026b
commit f8801cbcf1
4 changed files with 11 additions and 10 deletions

View File

@ -52,7 +52,7 @@ static void handler(int arg)
/*
* Print a text, escape all characters not in Latin-1.
*/
static void feputs(char *line, FILE *fp)
static void feputs(const char *line, FILE *fp)
{
unsigned char *p;
@ -132,7 +132,7 @@ static int file_isatty(const char *fname)
/*
* Wall function.
*/
void wall(char *text, int fromshutdown, int remote)
void wall(const char *text, int remote)
{
FILE *tp;
struct sigaction sa;

View File

@ -53,6 +53,9 @@ void initlog(int loglevel, char *fmt, ...);
void set_term(int how);
void print(char *fmt);
/* from dowall.c */
void wall(const char *text, int remote);
#if DEBUG
# define INITDBG(level, fmt, args...) initlog(level, fmt, ##args)
#else

View File

@ -49,6 +49,8 @@
#include "paths.h"
#include "reboot.h"
#include "initreq.h"
#include "init.h"
char *Version = "@(#) shutdown 2.86-1 31-Jul-2004 miquels@cistron.nl";
@ -72,9 +74,6 @@ char *clean_env[] = {
NULL,
};
/* From "wall.c" */
extern void wall(char *, int, int);
/* From "utmp.c" */
extern void write_wtmp(char *user, char *id, int pid, int type, char *line);
@ -206,7 +205,7 @@ void warn(int mins)
snprintf(buf + len, sizeof(buf) - len,
"\rThe system is going DOWN %s in %d minute%s!\r\n",
newstate, mins, mins == 1 ? "" : "s");
wall(buf, 1, 0);
wall(buf, 0);
}
/*
@ -619,7 +618,7 @@ int main(int argc, char **argv)
fprintf(stderr, "shutdown: not running.\n");
exit(1);
}
if (message[0]) wall(message, 1, 0);
if (message[0]) wall(message, 0);
exit(0);
}

View File

@ -29,14 +29,13 @@
#include <unistd.h>
#include <pwd.h>
#include <syslog.h>
#include "init.h"
char *Version = "@(#) wall 2.79 12-Sep-2000 miquels@cistron.nl";
#define MAXLEN 4096
#define MAXLINES 20
extern void wall(char *, int, int);
int main(int argc, char **argv)
{
char buf[MAXLEN];
@ -115,7 +114,7 @@ int main(int argc, char **argv)
closelog();
unsetenv("TZ");
wall(buf, 0, remote);
wall(buf, remote);
/*NOTREACHED*/
return 0;