From 708dca91f177a6557dd408e7a561b560c654a0b7 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Tue, 24 Feb 2009 18:41:46 -0500 Subject: [PATCH] Reset pwm->pid in pwmd_terminate_pinentry(). --- libpwmd.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libpwmd.c b/libpwmd.c index 6a224600..783f01f9 100644 --- a/libpwmd.c +++ b/libpwmd.c @@ -460,12 +460,16 @@ gpg_error_t pwmd_terminate_pinentry(pwm_t *pwm) #ifndef USE_PINENTRY return GPG_ERR_NOT_IMPLEMENTED; #else - if (!pwm || pwm->pid == -1) + pid_t pid = pwm->pid; + + pwm->pid = -1; + + if (!pwm || pid == -1) return GPG_ERR_INV_ARG; - if (kill(pwm->pid, 0) == 0) { - if (kill(pwm->pid, SIGTERM) == -1) { - if (kill(pwm->pid, SIGKILL) == -1) + if (kill(pid, 0) == 0) { + if (kill(pid, SIGTERM) == -1) { + if (kill(pid, SIGKILL) == -1) return gpg_error_from_errno(errno); } -- 2.11.4.GIT