The priv_open_* functions set errno on failure. It is passed in
the message from the privileged process on error. Otherwise, all
that is logged is the file name which is not too helpful.
There's still an issue where the message logged to the console is
preceded by 15 NUL bytes but that can be fixed separately.
OK?
- todd
Index: usr.sbin/syslogd/syslogd.c
===================================================================
RCS file: /cvs/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.205
diff -u -p -u -r1.205 syslogd.c
--- usr.sbin/syslogd/syslogd.c 2 Apr 2016 19:55:10 -0000 1.205
+++ usr.sbin/syslogd/syslogd.c 1 Jul 2016 12:43:29 -0000
@@ -1897,7 +1897,7 @@ fprintlog(struct filed *f, int flags, ch
retryonce = 1;
if (f->f_file < 0) {
f->f_type = F_UNUSED;
- logerrorx(f->f_un.f_fname);
+ logerror(f->f_un.f_fname);
} else
goto again;
} else if ((e == EPIPE || e == EBADF) &&
@@ -1906,7 +1906,7 @@ fprintlog(struct filed *f, int flags, ch
retryonce = 1;
if (f->f_file < 0) {
f->f_type = F_UNUSED;
- logerrorx(f->f_un.f_fname);
+ logerror(f->f_un.f_fname);
} else
goto again;
} else {
@@ -1959,7 +1959,7 @@ wallmsg(struct filed *f, struct iovec *i
if (reenter++)
return;
if ((uf = priv_open_utmp()) == NULL) {
- logerrorx(_PATH_UTMP);
+ logerror(_PATH_UTMP);
reenter = 0;
return;
}
@@ -2638,7 +2638,7 @@ cfline(char *line, char *progblock, char
f->f_file = priv_open_log(p);
if (f->f_file < 0) {
f->f_type = F_UNUSED;
- logerrorx(p);
+ logerror(p);
break;
}
if (isatty(f->f_file)) {