From: NIIBE Yutaka Date: Mon, 10 Sep 2018 00:16:50 +0000 (+0900) Subject: agent: Fix error code check from npth_mutex_init. X-Git-Tag: archive/raspbian/2.2.10-2+rpi1^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d0d901dca72b44f808507b5df00abf855540c1b3;p=gnupg2.git agent: Fix error code check from npth_mutex_init. * agent/call-pinentry.c (initialize_module_call_pinentry): It's an error when npth_mutex_init returns non-zero. -- Cherry-pick from master commit of: adce73b86fd49d5bbb8884231a26cc7533d400e2 Actually, initialize_module_call_pinentry is only called once from main. So, this bug had no harm and having the static variable INITIALIZED is not needed. Signed-off-by: NIIBE Yutaka (cherry picked from commit 213379debe5591dad6339aa95aa7282e0de620f9) Gbp-Pq: Name agent-Fix-error-code-check-from-npth_mutex_init.patch --- diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c index a088681..b68d0a8 100644 --- a/agent/call-pinentry.c +++ b/agent/call-pinentry.c @@ -98,11 +98,15 @@ void initialize_module_call_pinentry (void) { static int initialized; + int err; if (!initialized) { - if (npth_mutex_init (&entry_lock, NULL)) - initialized = 1; + err = npth_mutex_init (&entry_lock, NULL); + if (err) + log_fatal ("error initializing mutex: %s\n", strerror (err)); + + initialized = 1; } }