[git] GnuPG - branch, master, updated. gnupg-2.1.19-74-g2c9d9ac

by Werner Koch cvs at cvs.gnupg.org
Thu Mar 23 18:00:16 CET 2017


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  2c9d9ac55ea455a5ec26428989dced0311ed46cc (commit)
      from  178b6314ab2d2268873067314744c8af74dc331e (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 2c9d9ac55ea455a5ec26428989dced0311ed46cc
Author: Werner Koch <wk at gnupg.org>
Date:   Thu Mar 23 11:45:17 2017 +0100

    tests: Use gpgconf to stop the agent.
    
    * tests/openpgp/defs.scm (stop-agent): Swap order of actions.  Kill
    all daemons using gpgconf.
    * tools/gpgconf.c (main) <aRemoveSocketDir>: Try to remove known
    socketfails on rmdir failure.  Do no fail for ENONET.
    --
    
    Killing all daemons is not really required but it does not harm to be
    prepared for the future.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index 7c8e10a..e8d06c0 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -453,10 +453,12 @@
 				"|--debug-quick-random")
 		/bye)))
 
-;; Stop the agent and remove the socket dir.
+;; Stop the agent and other daemons and remove the socket dir.
 (define (stop-agent)
   (log "Stopping gpg-agent...")
+  (call-check `(,(tool 'gpgconf) --kill all))
   (catch (log "Warning: Removing socket directory failed.")
-	 (call-popen `(,(tool 'gpgconf) --remove-socketdir) ""))
-  (call-check `(,(tool 'gpg-connect-agent) --verbose --no-autostart
-		killagent /bye)))
+	 (call-popen `(,(tool 'gpgconf) --remove-socketdir) "")))
+
+
+;; end
diff --git a/tools/gpgconf.c b/tools/gpgconf.c
index c6fb24e..d6bf9a2 100644
--- a/tools/gpgconf.c
+++ b/tools/gpgconf.c
@@ -456,6 +456,7 @@ query_swdb (estream_t out, const char *name, const char *current_version)
 int
 main (int argc, char **argv)
 {
+  gpg_error_t err;
   ARGPARSE_ARGS pargs;
   const char *fname;
   int no_more_options = 0;
@@ -755,7 +756,42 @@ main (int argc, char **argv)
         else if (opt.dry_run)
           ;
         else if (rmdir (socketdir))
-          gc_error (1, errno, "error removing '%s'", socketdir);
+          {
+            /* If the director is not empty we first try to delet
+             * socket files.  */
+            err = gpg_error_from_syserror ();
+            if (gpg_err_code (err) == GPG_ERR_ENOTEMPTY
+                || gpg_err_code (err) == GPG_ERR_EEXIST)
+              {
+                static const char * const names[] = {
+                  GPG_AGENT_SOCK_NAME,
+                  GPG_AGENT_EXTRA_SOCK_NAME,
+                  GPG_AGENT_BROWSER_SOCK_NAME,
+                  GPG_AGENT_SSH_SOCK_NAME,
+                  SCDAEMON_SOCK_NAME,
+                  DIRMNGR_SOCK_NAME
+                };
+                int i;
+                char *p;
+
+                for (i=0; i < DIM(names); i++)
+                  {
+                    p = strconcat (socketdir , "/", names[i], NULL);
+                    if (p)
+                      gnupg_remove (p);
+                    xfree (p);
+                  }
+                if (rmdir (socketdir))
+                  gc_error (1, 0, "error removing '%s': %s",
+                            socketdir, gpg_strerror (err));
+              }
+            else if (gpg_err_code (err) == GPG_ERR_ENOENT)
+              gc_error (0, 0, "warning: removing '%s' failed: %s",
+                        socketdir, gpg_strerror (err));
+            else
+              gc_error (1, 0, "error removing '%s': %s",
+                        socketdir, gpg_strerror (err));
+          }
 
         xfree (socketdir);
       }

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

Summary of changes:
 tests/openpgp/defs.scm | 10 ++++++----
 tools/gpgconf.c        | 38 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 43 insertions(+), 5 deletions(-)


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




More information about the Gnupg-commits mailing list