diff options
author | Felix Riemann <felix.riemann@sma.de> | 2019-05-29 21:17:42 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-05-30 09:54:54 +0200 |
commit | d8f8b18cdb099ac0604d26037e2f9f9f5bd135ce (patch) | |
tree | 95348863de15fae1ca3bf16400eba6ca8f929c61 | |
parent | 38ab1ec9c8be5c4a728b3f27697eb9a3e4b37278 (diff) | |
download | systemd-d8f8b18cdb099ac0604d26037e2f9f9f5bd135ce.tar.gz |
pager: Fix deadlock when using built-in pager
The parent is waiting for an EOF on the pipe transmitting the pager name
before starting to send data. With external pagers this happens due to
execlp() CLOEXEC'ing the pipe, so the internal pager needs to close it
manually.
-rw-r--r-- | src/shared/pager.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/shared/pager.c b/src/shared/pager.c index 2abb0f62d2..7c20b100b4 100644 --- a/src/shared/pager.c +++ b/src/shared/pager.c @@ -194,11 +194,13 @@ int pager_open(PagerFlags flags) { "Failed to execute '%s', using next fallback pager: %m", exe); } - r = loop_write(exe_name_pipe[1], "(built-in)", strlen("(built-in") + 1, false); + r = loop_write(exe_name_pipe[1], "(built-in)", strlen("(built-in)") + 1, false); if (r < 0) { log_error_errno(r, "Failed to write pager name to socket: %m"); _exit(EXIT_FAILURE); } + /* Close pipe to signal the parent to start sending data */ + safe_close_pair(exe_name_pipe); pager_fallback(); /* not reached */ } |