From: Lennart Poettering Date: Mon, 3 Mar 2025 12:56:44 +0000 (+0100) Subject: tty-askpw-agent: react to SIGTERM while waiting for console (#36568) X-Git-Tag: v258-rc1~1202 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6263fda39bbad055cbfe7412eef1364f89eee22b;p=thirdparty%2Fsystemd.git tty-askpw-agent: react to SIGTERM while waiting for console (#36568) I noticed that systemd-tty-password-agent would time out when asked to stop via SIGTERM, and eventually be killed, under some circumstances. It took me a while but i figured out what was going on: systemd-ask-pw-agent blocks SIGTERM because it wants async notifications on SIGTERM via signalfd() to listen on. That mostly works great: except for one case: if we actually get a pw query request, and hence need to acquire the terminal: we issue open_terminal() in that case, but if the terminal is used otherwsie we'll hang, and because SIGTERM is blocked we'll hang and cannot exit cleanly. Address that: optionally, in open_terminal() look for SIGTERM by unblcking the signal mask via ppoll() while we wait. --- 6263fda39bbad055cbfe7412eef1364f89eee22b