getty, sulogin: convert to using bb_msg for syslog output
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
#include <stdlib.h>
|
||||
#include "libbb.h"
|
||||
|
||||
int die_sleep;
|
||||
|
||||
void bb_error_msg_and_die(const char *s, ...)
|
||||
{
|
||||
va_list p;
|
||||
@@ -20,5 +22,7 @@ void bb_error_msg_and_die(const char *s, ...)
|
||||
va_start(p, s);
|
||||
bb_verror_msg(s, p, NULL);
|
||||
va_end(p);
|
||||
if (die_sleep)
|
||||
sleep(die_sleep);
|
||||
exit(bb_default_error_retval);
|
||||
}
|
||||
|
@@ -20,5 +20,7 @@ void bb_fflush_stdout_and_exit(int retval)
|
||||
if (fflush(stdout)) {
|
||||
retval = bb_default_error_retval;
|
||||
}
|
||||
if (die_sleep)
|
||||
sleep(die_sleep);
|
||||
exit(retval);
|
||||
}
|
||||
|
@@ -19,5 +19,7 @@ void bb_herror_msg_and_die(const char *s, ...)
|
||||
va_start(p, s);
|
||||
bb_vherror_msg(s, p);
|
||||
va_end(p);
|
||||
if (die_sleep)
|
||||
sleep(die_sleep);
|
||||
exit(bb_default_error_retval);
|
||||
}
|
||||
|
@@ -20,5 +20,7 @@ void bb_perror_msg_and_die(const char *s, ...)
|
||||
va_start(p, s);
|
||||
bb_vperror_msg(s, p);
|
||||
va_end(p);
|
||||
if (die_sleep)
|
||||
sleep(die_sleep);
|
||||
exit(bb_default_error_retval);
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "libbb.h"
|
||||
|
||||
int logmode = LOGMODE_STDIO;
|
||||
const char *msg_eol = "\n";
|
||||
|
||||
void bb_verror_msg(const char *s, va_list p, const char* strerr)
|
||||
{
|
||||
@@ -28,9 +29,9 @@ void bb_verror_msg(const char *s, va_list p, const char* strerr)
|
||||
fprintf(stderr, "%s: ", bb_applet_name);
|
||||
vfprintf(stderr, s, p);
|
||||
if (!strerr)
|
||||
fputc('\n', stderr);
|
||||
fputs(msg_eol, stderr);
|
||||
else
|
||||
fprintf(stderr, ": %s\n", strerr);
|
||||
fprintf(stderr, ": %s%s", strerr, msg_eol);
|
||||
}
|
||||
if (ENABLE_FEATURE_SYSLOG && (logmode & LOGMODE_SYSLOG)) {
|
||||
if (!strerr)
|
||||
|
@@ -22,7 +22,7 @@ void bb_vinfo_msg(const char *s, va_list p)
|
||||
va_copy(p2, p);
|
||||
if (logmode & LOGMODE_STDIO) {
|
||||
vprintf(s, p);
|
||||
putchar('\n');
|
||||
fputs(msg_eol, stdout);
|
||||
}
|
||||
if (ENABLE_FEATURE_SYSLOG && (logmode & LOGMODE_SYSLOG))
|
||||
vsyslog(LOG_INFO, s, p2);
|
||||
|
@@ -12,6 +12,6 @@
|
||||
void bb_warn_ignoring_args(int n)
|
||||
{
|
||||
if (n) {
|
||||
bb_perror_msg("ignoring all arguments");
|
||||
bb_error_msg("ignoring all arguments");
|
||||
}
|
||||
}
|
||||
|
@@ -408,7 +408,8 @@ char *xasprintf(const char *format, ...)
|
||||
void xprint_and_close_file(FILE *file)
|
||||
{
|
||||
// copyfd outputs error messages for us.
|
||||
if (bb_copyfd_eof(fileno(file), 1) == -1) exit(bb_default_error_retval);
|
||||
if (bb_copyfd_eof(fileno(file), 1) == -1)
|
||||
exit(bb_default_error_retval);
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
Reference in New Issue
Block a user