mirror of
https://github.com/troglobit/finit.git
synced 2026-11-13 17:00:16 +00:00
service: fix service log priority in fallback mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 file changed
+8
-5
+8
-5
@@ -244,6 +244,9 @@ static void fallback_logger(char *ident, char *prio)
|
|||||||
int level = LOG_NOTICE;
|
int level = LOG_NOTICE;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
|
strlcpy(buf, prio, sizeof(buf));
|
||||||
|
log_parse(buf, &facility, &level);
|
||||||
|
|
||||||
prctl(PR_SET_NAME, "finitlog", 0, 0, 0);
|
prctl(PR_SET_NAME, "finitlog", 0, 0, 0);
|
||||||
openlog(ident, LOG_NOWAIT | LOG_PID, facility);
|
openlog(ident, LOG_NOWAIT | LOG_PID, facility);
|
||||||
while ((fgets(buf, sizeof(buf), stdin)))
|
while ((fgets(buf, sizeof(buf), stdin)))
|
||||||
@@ -327,6 +330,11 @@ static int lredirect(svc_t *svc)
|
|||||||
/* Default syslog identity name[:id] */
|
/* Default syslog identity name[:id] */
|
||||||
tag = svc_ident(svc, buf, sizeof(buf));
|
tag = svc_ident(svc, buf, sizeof(buf));
|
||||||
|
|
||||||
|
if (svc->log.ident[0])
|
||||||
|
tag = svc->log.ident;
|
||||||
|
if (svc->log.prio[0])
|
||||||
|
prio = svc->log.prio;
|
||||||
|
|
||||||
if (!have_sysklogd && !whichp(_PATH_LOGIT)) {
|
if (!have_sysklogd && !whichp(_PATH_LOGIT)) {
|
||||||
logit(LOG_INFO, _PATH_LOGIT " missing, using syslog for %s instead", svc->name);
|
logit(LOG_INFO, _PATH_LOGIT " missing, using syslog for %s instead", svc->name);
|
||||||
fallback_logger(tag, prio);
|
fallback_logger(tag, prio);
|
||||||
@@ -352,11 +360,6 @@ static int lredirect(svc_t *svc)
|
|||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (svc->log.ident[0])
|
|
||||||
tag = svc->log.ident;
|
|
||||||
if (svc->log.prio[0])
|
|
||||||
prio = svc->log.prio;
|
|
||||||
|
|
||||||
if (have_sysklogd) {
|
if (have_sysklogd) {
|
||||||
char pid[16];
|
char pid[16];
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user