agent: Fix error code check from npth_mutex_init.
authorNIIBE Yutaka <gniibe@fsij.org>
Mon, 10 Sep 2018 00:16:50 +0000 (09:16 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Mon, 10 Sep 2018 00:16:50 +0000 (09:16 +0900)
* agent/call-pinentry.c (initialize_module_call_pinentry): It's an
error when npth_mutex_init returns non-zero.

--

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 <gniibe@fsij.org>
agent/call-pinentry.c

index af4eb06..048443a 100644 (file)
@@ -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;
     }
 }