Reported by Erik van der Kouwe <vdkouwe at cs.vu.nl>:

-  fprintf(stderr, "%s: reboot(): %s\n", strerror(errno));
+  fprintf(stderr, "%s: reboot(): %s\n", prog, strerror(errno));
  
Other minor fixes inspired by other warnings produced by gcc.
This commit is contained in:
Ben Gras 2007-07-02 11:16:27 +00:00
parent ad93329236
commit 2746a5a2a9
4 changed files with 10 additions and 20 deletions

View file

@ -128,6 +128,6 @@ char **argv;
sync();
reboot(flag, monitor_code, strlen(monitor_code));
fprintf(stderr, "%s: reboot(): %s\n", strerror(errno));
fprintf(stderr, "%s: reboot(): %s\n", prog, strerror(errno));
return 1;
}

View file

@ -38,10 +38,10 @@ char *extra; /* If non-nil, why is the shutdown */
struct utsname utsname;
struct stat con_st, tty_st;
if (ourtty = ttyname(1)) {
if (ourname = strrchr(ourtty, '/')) ourtty = ourname+1;
if ((ourtty = ttyname(1))) {
if ((ourname = strrchr(ourtty, '/'))) ourtty = ourname+1;
} else ourtty = "system task";
if (pw = getpwuid(getuid())) ourname = pw->pw_name;
if ((pw = getpwuid(getuid()))) ourname = pw->pw_name;
else ourname = "unknown";
time(&now);
@ -96,7 +96,7 @@ char *message, *more;
char *m = more;
char *end = message + 1024 - 1;
while (p < end && *p != 0) *p++;
while (p < end && *p != 0) p++;
while (p < end && *m != 0) {
if (*m == '\n' && (p == message || p[-1] != '\n')) {

View file

@ -55,7 +55,7 @@ void wall _ARGS(( char *when, char *extra ));
int crash_check _ARGS(( void ));
void parse_time _ARGS(( char *arg ));
void get_message _ARGS(( void ));
void main _ARGS(( int argc, char *argv[] ));
int main _ARGS(( int argc, char *argv[] ));
char *itoa _ARGS(( int n ));
long wait_time=0L;
@ -123,7 +123,7 @@ char *arg;
return;
}
void main(argc,argv)
int main(argc,argv)
int argc;
char *argv[];
{
@ -265,7 +265,8 @@ char *argv[];
sleep(2);
reboot(RBT_HALT);
fprintf(stderr, "Reboot call failed: %s\n", strerror(errno));
exit(1);
return(1);
}
void usage()
@ -289,7 +290,6 @@ void terminate()
FILE *in;
pid_t pid;
char c_pid[5];
char buf[80];
in = fopen(SHUT_PID,"r");
if (in == (FILE *)0) {
@ -305,21 +305,12 @@ void terminate()
puts("Shutdown process terminated");
unlink(SHUT_PID);
unlink(NOLOGIN);
#ifdef not_very_useful
in = fopen (SHUT_LOG,"a");
if (in == (FILE *)0)
exit(0);
sprintf (buf, "Shutdown with pid %d terminated\n",pid);
fputs(buf,in);
fclose(in);
#endif
exit(0);
}
void get_message()
{
char line[80];
int max_lines=12;
puts ("Type your message. End with ^D at an empty line");
fputs ("shutdown> ",stdout);fflush(stdout);
@ -367,7 +358,7 @@ void inform_user()
else
if (wait_time > 1)
sprintf(mes,
"\nThe system will shutdown in %d seconds\n\n",
"\nThe system will shutdown in %ld seconds\n\n",
wait_time);
else
sprintf(mes,

View file

@ -15,7 +15,6 @@
int main(int argc, char **argv)
{
int flag;
char *prog;
char *reboot_code = "delay; boot";