Skip to content

Commit 5c31441

Browse files
DaanDeMeyerbluca
authored andcommitted
core: Always call log_open() in systemd-executor
log_setup() will open the console in systemd-executor because it's not pid 1 and it's not connected to the journal. So if the log target is later changed to kmsg, we have to reopen the log. But since log_open() won't open the same log twice, let's just call it unconditionally since it will be a noop if we try to reopen the same log. This makes sure that systemd-executor will log to the log target passed via --log-target= after parsing arguments.
1 parent ee77e0b commit 5c31441

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/core/executor.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,9 @@ int main(int argc, char *argv[]) {
207207
if (r <= 0)
208208
return r;
209209

210-
/* Now try again if we were told it's fine to use a different target */
211-
if (log_get_target() != LOG_TARGET_KMSG) {
212-
log_set_prohibit_ipc(false);
213-
log_open();
214-
}
210+
/* Now that we know the intended log target, allow IPC and open the final log target. */
211+
log_set_prohibit_ipc(false);
212+
log_open();
215213

216214
/* Initialize lazily. SMACK is just a few operations, but the SELinux is very slow as it requires
217215
* loading the entire database in memory, so we will do it lazily only if it is actually needed, to

0 commit comments

Comments
 (0)