[git] GnuPG - branch, master, updated. gnupg-2.2.7-287-g483e63f

by NIIBE Yutaka cvs at cvs.gnupg.org
Tue Nov 27 03:12:31 CET 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  483e63f9b5faead819ddd28308902ef43bf298ab (commit)
      from  f12fcd907903742bde3ebb7ffef244c92d6d1611 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 483e63f9b5faead819ddd28308902ef43bf298ab
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Tue Nov 27 11:08:51 2018 +0900

    agent: Better serialization for scdaemon access.
    
    * agent/call-scd.c (unlock_scd): Move lock before accessing IN_USE.
    (wait_child_thread): Add log_info for Windows, and fixed log_error
    message.
    
    --
    
    The old code is still valid with cooperate threads, but this is
    better.
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/agent/call-scd.c b/agent/call-scd.c
index c6d062a..796e7d8 100644
--- a/agent/call-scd.c
+++ b/agent/call-scd.c
@@ -169,29 +169,25 @@ unlock_scd (ctrl_t ctrl, int rc)
       if (!rc)
         rc = gpg_error (GPG_ERR_INTERNAL);
     }
+  err = npth_mutex_lock (&start_scd_lock);
+  if (err)
+    {
+      log_error ("failed to acquire the start_scd lock: %s\n", strerror (err));
+      return gpg_error (GPG_ERR_INTERNAL);
+    }
   ctrl->scd_local->in_use = 0;
   if (ctrl->scd_local->invalid)
     {
-      err = npth_mutex_lock (&start_scd_lock);
-      if (err)
-        {
-          log_error ("failed to acquire the start_scd lock: %s\n",
-                     strerror (err));
-          return gpg_error (GPG_ERR_INTERNAL);
-        }
-
       assuan_release (ctrl->scd_local->ctx);
       ctrl->scd_local->ctx = NULL;
-
-      err = npth_mutex_unlock (&start_scd_lock);
-      if (err)
-        {
-          log_error ("failed to release the start_scd lock: %s\n",
-                     strerror (err));
-          return gpg_error (GPG_ERR_INTERNAL);
-        }
+      ctrl->scd_local->invalid = 0;
+    }
+  err = npth_mutex_unlock (&start_scd_lock);
+  if (err)
+    {
+      log_error ("failed to release the start_scd lock: %s\n", strerror (err));
+      return gpg_error (GPG_ERR_INTERNAL);
     }
-  ctrl->scd_local->invalid = 0;
   return rc;
 }
 
@@ -219,6 +215,7 @@ wait_child_thread (void *arg)
   npth_unprotect ();
   WaitForSingleObject ((HANDLE)pid, INFINITE);
   npth_protect ();
+  log_info ("scdaemon finished\n");
 #else
   int wstatus;
   pid_t pid = (pid_t)(uintptr_t)arg;
@@ -278,8 +275,8 @@ wait_child_thread (void *arg)
 
       err = npth_mutex_unlock (&start_scd_lock);
       if (err)
-        log_error ("failed to release the start_scd lock while"
-                   " doing the aliveness check: %s\n", strerror (err));
+        log_error ("failed to release the start_scd lock after waitpid",
+                   strerror (err));
     }
 
   return NULL;

-----------------------------------------------------------------------

Summary of changes:
 agent/call-scd.c | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list