From: Lennart Poettering Date: Wed, 13 Apr 2011 19:43:36 +0000 (+0200) Subject: ask-password: use kill(PID, 0) before querying a password X-Git-Tag: v25~54 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=ded803353137a5b33d3fc460790c0e9b5cb257c1 ask-password: use kill(PID, 0) before querying a password --- diff --git a/src/tty-ask-password-agent.c b/src/tty-ask-password-agent.c index 4a29abacb..d7e1ebaef 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) {