Always log to stderr in ceoc

The python thing will read errors from stderr, we need to log there
even if it's not a tty.
This commit is contained in:
Michael Spang 2009-08-06 00:59:46 -04:00
parent e3555e5b74
commit b348f5d5bd
7 changed files with 8 additions and 8 deletions

View File

@ -84,7 +84,7 @@ int main(int argc, char *argv[]) {
int ret;
prog = xstrdup(basename(argv[0]));
init_log(prog, LOG_PID, LOG_AUTHPRIV);
init_log(prog, LOG_PID, LOG_AUTHPRIV, 1);
configure();

View File

@ -94,7 +94,7 @@ int main(int argc, char *argv[]) {
int ret;
prog = xstrdup(basename(argv[0]));
init_log(prog, LOG_PID, LOG_AUTHPRIV);
init_log(prog, LOG_PID, LOG_AUTHPRIV, 1);
configure();

View File

@ -140,7 +140,7 @@ int main(int argc, char *argv[]) {
char *op;
prog = xstrdup(basename(argv[0]));
init_log(prog, LOG_PID, LOG_USER);
init_log(prog, LOG_PID, LOG_USER, 1);
configure();
setup_ops();

View File

@ -154,7 +154,7 @@ int main(int argc, char *argv[]) {
int ret;
prog = xstrdup(basename(argv[0]));
init_log(prog, LOG_PID, LOG_DAEMON);
init_log(prog, LOG_PID, LOG_DAEMON, 0);
configure();

View File

@ -282,7 +282,7 @@ void cmd_adduser(void) {
int main(int argc, char *argv[]) {
prog = xstrdup(basename(argv[0]));
init_log(prog, LOG_PID, LOG_AUTHPRIV);
init_log(prog, LOG_PID, LOG_AUTHPRIV, 0);
configure();

View File

@ -14,9 +14,9 @@
static int log_stderr = 1;
void init_log(const char *ident, int option, int facility) {
void init_log(const char *ident, int option, int facility, int lstderr) {
openlog(ident, option, facility);
log_stderr = isatty(STDERR_FILENO);
log_stderr = lstderr || isatty(STDERR_FILENO);
}
static void errmsg(int prio, const char *prefix, const char *fmt, va_list args) {

View File

@ -33,7 +33,7 @@ ssize_t full_read(int fd, void *buf, size_t len);
FILE *fopenat(DIR *d, const char *path, int flags);
void make_env(char **envp, ...);
void free_env(char **envp);
void init_log(const char *ident, int option, int facility);
void init_log(const char *ident, int option, int facility, int lstderr);
int check_group(char *username, char *group);
PRINTF_LIKE(0) NORETURN void fatal(const char *, ...);