summaryrefslogtreecommitdiffstats
path: root/src/coredump
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-02-22 00:35:00 +0100
committerLennart Poettering <lennart@poettering.net>2018-02-22 00:35:00 +0100
commit0b1f3c768ce1bd1490a5e53f539976dcef8ca765 (patch)
tree913fbc34316957cd4c07ef0b3fb0fb06a005851d /src/coredump
parentshutdown: explicitly set a log target in shutdown.c (diff)
downloadsystemd-0b1f3c768ce1bd1490a5e53f539976dcef8ca765.tar.xz
systemd-0b1f3c768ce1bd1490a5e53f539976dcef8ca765.zip
tree-wide: reopen log when we need to log in FORK_CLOSE_ALL_FDS children
In a number of occasions we use FORK_CLOSE_ALL_FDS when forking off a child, since we don't want to pass fds to the processes spawned (either because we later want to execve() some other process there, or because our child might hang around for longer than expected, in which case it shouldn't keep our fd pinned). This also closes any logging fds, and thus means logging is turned off in the child. If we want to do proper logging, explicitly reopen the logs hence in the child at the right time. This is particularly crucial in the umount/remount children we fork off the shutdown binary, as otherwise the children can't log, which is why #8155 is harder to debug than necessary: the log messages we generate about failing mount() system calls aren't actually visible on screen, as they done in the child processes where the log fds are closed.
Diffstat (limited to 'src/coredump')
-rw-r--r--src/coredump/coredumpctl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c
index 09178d5035..6b697c37fc 100644
--- a/src/coredump/coredumpctl.c
+++ b/src/coredump/coredumpctl.c
@@ -932,6 +932,7 @@ static int run_gdb(sd_journal *j) {
goto finish;
if (r == 0) {
execlp("gdb", "gdb", exe, path, NULL);
+ log_open();
log_error_errno(errno, "Failed to invoke gdb: %m");
_exit(EXIT_FAILURE);
}