summaryrefslogtreecommitdiff
path: root/src/basic/process-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-03-10 21:54:59 +0100
committerLennart Poettering <lennart@poettering.net>2021-03-11 08:55:20 +0100
commit48f813c4aab307695b853cbd3ea3c85f22486898 (patch)
treec3ec84492fd43f5db7e0214c10f330cf3fe4d996 /src/basic/process-util.c
parentc9c4899f4444d9586e541b5e72597a37f949433a (diff)
downloadsystemd-48f813c4aab307695b853cbd3ea3c85f22486898.tar.gz
coredumpctl: fflush() stdout before invoking gdb
Fixes: #18936
Diffstat (limited to 'src/basic/process-util.c')
-rw-r--r--src/basic/process-util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 4eb524d211..d3eb3ad18b 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -1230,6 +1230,11 @@ int safe_fork_full(
original_pid = getpid_cached();
+ if (flags & FORK_FLUSH_STDIO) {
+ fflush(stdout);
+ fflush(stderr); /* This one shouldn't be necessary, stderr should be unbuffered anyway, but let's better be safe than sorry */
+ }
+
if (flags & (FORK_RESET_SIGNALS|FORK_DEATHSIG)) {
/* We temporarily block all signals, so that the new child has them blocked initially. This way, we can
* be sure that SIGTERMs are not lost we might send to the child. */