From ded803353137a5b33d3fc460790c0e9b5cb257c1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 13 Apr 2011 21:43:36 +0200 Subject: [PATCH] ask-password: use kill(PID, 0) before querying a password --- src/tty-ask-password-agent.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/tty-ask-password-agent.c b/src/tty-ask-password-agent.c index 4a29abac..d7e1ebae 100644 --- a/src/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent.c @@ -291,6 +291,13 @@ static int parse_password(const char *filename, char **wall) { } } + if (pid > 0 && + kill(pid, 0) < 0 && + errno == ESRCH) { + r = 0; + goto finish; + } + if (arg_action == ACTION_LIST) printf("'%s' (PID %u)\n", message, pid); else if (arg_action == ACTION_WALL) { -- 2.39.5