Skip to content

Commit

Permalink
Merge pull request #388 from soggyfries/soggyfries-log-fix
Browse files Browse the repository at this point in the history
Fix log child exiting with debug disabled
  • Loading branch information
troglobit authored Dec 19, 2023
2 parents ed88469 + efc0592 commit 06adeca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,15 @@ static int lredirect(svc_t *svc)

snprintf(rot, sizeof(rot), "%d:%d", logfile_size_max, logfile_count_max);
snprintf(pid, sizeof(pid), "%d", svc_pid);
execlp("logger", "logger", "-f", svc->log.file, "-b", "-t", tag, "-p", prio, debug ? "-s" : "", "-I", pid, "-r", rot, NULL);
execlp("logger", "logger", "-f", svc->log.file, "-b", "-t", tag, "-p", prio, "-I", pid, "-r", rot, debug ? "-s" : NULL, NULL);
} else {
char sz[20], num[3];

snprintf(sz, sizeof(sz), "%d", logfile_size_max);
snprintf(num, sizeof(num), "%d", logfile_count_max);

execlp(_PATH_LOGIT, "logit", "-f", svc->log.file, "-n", sz, "-r", num, debug ? "-s" : "", NULL);
execlp(_PATH_LOGIT, "logit", "-f", svc->log.file, "-n", sz, "-r", num, debug ? "-s" : NULL, NULL);

}
_exit(1);
}
Expand All @@ -351,9 +352,9 @@ static int lredirect(svc_t *svc)
char pid[16];

snprintf(pid, sizeof(pid), "%d", svc_pid);
execlp("logger", "logger", "-t", tag, "-p", prio, debug ? "-s" : "", "-I", pid, NULL);
execlp("logger", "logger", "-t", tag, "-p", prio, "-I", pid, debug ? "-s" : NULL, NULL);
} else {
execlp(_PATH_LOGIT, "logit", "-t", tag, "-p", prio, debug ? "-s" : "", NULL);
execlp(_PATH_LOGIT, "logit", "-t", tag, "-p", prio, debug ? "-s" : NULL, NULL);
}
_exit(1);
}
Expand Down

0 comments on commit 06adeca

Please sign in to comment.