summaryrefslogtreecommitdiffstats
path: root/src/tty-ask-password-agent
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-03-18 14:19:20 +0100
committerLennart Poettering <lennart@poettering.net>2022-03-18 17:13:36 +0100
commit52bb308c138dd1006078370c93e0e77dfc61de73 (patch)
treee7f604afa7a057a78fb65f383fa5e723f9ab614d /src/tty-ask-password-agent
parentshell-completion: Add completion for oomctl (diff)
downloadsystemd-52bb308c138dd1006078370c93e0e77dfc61de73.tar.xz
systemd-52bb308c138dd1006078370c93e0e77dfc61de73.zip
time-util: add macros around timespec_store() that operates on compund literal allocated timespec struct
This way we can convert usec_t to timespec on-the-fly, without a buffer. No actual behaviour change just some shortening of code.
Diffstat (limited to 'src/tty-ask-password-agent')
-rw-r--r--src/tty-ask-password-agent/tty-ask-password-agent.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c
index e98b38510e..2535593775 100644
--- a/src/tty-ask-password-agent/tty-ask-password-agent.c
+++ b/src/tty-ask-password-agent/tty-ask-password-agent.c
@@ -581,8 +581,6 @@ static int ask_on_this_console(const char *tty, pid_t *ret_pid, char **arguments
}
static void terminate_agents(Set *pids) {
- struct timespec ts;
- siginfo_t status = {};
sigset_t set;
void *p;
int r, signum;
@@ -599,11 +597,10 @@ static void terminate_agents(Set *pids) {
*/
assert_se(sigemptyset(&set) >= 0);
assert_se(sigaddset(&set, SIGCHLD) >= 0);
- timespec_store(&ts, 50 * USEC_PER_MSEC);
while (!set_isempty(pids)) {
+ siginfo_t status = {};
- zero(status);
r = waitid(P_ALL, 0, &status, WEXITED|WNOHANG);
if (r < 0 && errno == EINTR)
continue;
@@ -613,7 +610,7 @@ static void terminate_agents(Set *pids) {
continue;
}
- signum = sigtimedwait(&set, NULL, &ts);
+ signum = sigtimedwait(&set, NULL, TIMESPEC_STORE(50 * USEC_PER_MSEC));
if (signum < 0) {
if (errno != EAGAIN)
log_error_errno(errno, "sigtimedwait() failed: %m");