[git] GPGME - branch, master, updated. gpgme-1.8.0-54-g93a5907

by Werner Koch cvs at cvs.gnupg.org
Fri Feb 3 13:15:40 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 "GnuPG Made Easy".

The branch, master has been updated
       via  93a59070c699d569d1eac7ba22355fe3f5d10882 (commit)
       via  afc308598d1ddaf20d54b4eab30b959066a4e5e6 (commit)
      from  43160a39f27f6c3507447620666c85af00b3499c (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 93a59070c699d569d1eac7ba22355fe3f5d10882
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Feb 3 13:13:22 2017 +0100

    core: Fix possible deadlock due to get_max_fds.
    
    * src/posix-io.c (get_max_fds): Do not use the Linux optimization.
    --
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/posix-io.c b/src/posix-io.c
index 5296f5f..cabb3e5 100644
--- a/src/posix-io.c
+++ b/src/posix-io.c
@@ -287,37 +287,43 @@ get_max_fds (void)
   int rc;
 
   /* Under Linux we can figure out the highest used file descriptor by
-   * reading /proc/self/fd.  This is in the common cases much fast than
-   * for example doing 4096 close calls where almost all of them will
-   * fail.  */
-#ifdef __linux__
-  {
-    DIR *dir = NULL;
-    struct dirent *dir_entry;
-    const char *s;
-    int x;
-
-    dir = opendir ("/proc/self/fd");
-    if (dir)
-      {
-        while ((dir_entry = readdir (dir)))
-          {
-            s = dir_entry->d_name;
-            if ( *s < '0' || *s > '9')
-              continue;
-            x = atoi (s);
-            if (x > fds)
-              fds = x;
-          }
-        closedir (dir);
-      }
-    if (fds != -1)
-      {
-        fds++;
-        source = "/proc";
-      }
-    }
-#endif /* __linux__ */
+   * reading /proc/self/fd.  This is in the common cases much faster
+   * than for example doing 4096 close calls where almost all of them
+   * will fail.
+   *
+   * Unfortunately we can't call opendir between fork and exec in a
+   * multi-threaded process because opendir uses malloc and thus a
+   * mutex which may deadlock with a malloc in another thread.  Thus
+   * the code is not used until we can have a opendir variant which
+   * does not use malloc.  */
+/* #ifdef __linux__ */
+/*   { */
+/*     DIR *dir = NULL; */
+/*     struct dirent *dir_entry; */
+/*     const char *s; */
+/*     int x; */
+
+/*     dir = opendir ("/proc/self/fd"); */
+/*     if (dir) */
+/*       { */
+/*         while ((dir_entry = readdir (dir))) */
+/*           { */
+/*             s = dir_entry->d_name; */
+/*             if ( *s < '0' || *s > '9') */
+/*               continue; */
+/*             x = atoi (s); */
+/*             if (x > fds) */
+/*               fds = x; */
+/*           } */
+/*         closedir (dir); */
+/*       } */
+/*     if (fds != -1) */
+/*       { */
+/*         fds++; */
+/*         source = "/proc"; */
+/*       } */
+/*     } */
+/* #endif /\* __linux__ *\/ */
 
 #ifdef RLIMIT_NOFILE
   if (fds == -1)

commit afc308598d1ddaf20d54b4eab30b959066a4e5e6
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Feb 3 13:08:39 2017 +0100

    core: Minor cleanup of commit 195c735
    
    * src/verify.c (parse_tofu_user): For cleanness use gpg_error ...
    (_gpgme_verify_status_handler): ... and gpg_err_code.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/verify.c b/src/verify.c
index 398cec5..900f925 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -685,7 +685,7 @@ parse_tofu_user (gpgme_signature_t sig, char *args, gpgme_protocol_t protocol)
     {
       /* GnuPG since 2.1.17 emits multiple TOFU_USER lines with
          different fingerprints in case of conflicts for a signature. */
-      err = GPG_ERR_DUP_VALUE;
+      err = gpg_error (GPG_ERR_DUP_VALUE);
       goto leave;
     }
 
@@ -1003,13 +1003,13 @@ _gpgme_verify_status_handler (void *priv, gpgme_status_code_t code, char *args)
         return trace_gpg_error (GPG_ERR_INV_ENGINE);
       err = parse_tofu_user (sig, args, ctx->protocol);
       /* gpg emits TOFU User lines for each conflicting key.
-         GPGME does not expose this to have a clean API and
-         a GPGME user can do a keylisting with the address
-         normalisation.
-         So when a duplicated TOFU_USER line is encountered
-         we ignore the conflicting tofu stats emited afterwards.
-      */
-      if (err == GPG_ERR_DUP_VALUE)
+       * GPGME does not expose this to have a clean API and
+       * a GPGME user can do a keylisting with the address
+       * normalisation.
+       * So when a duplicated TOFU_USER line is encountered
+       * we ignore the conflicting tofu stats emited afterwards.
+       */
+      if (gpg_err_code (err) == GPG_ERR_DUP_VALUE)
         {
           opd->conflict_user_seen = 1;
           break;

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

Summary of changes:
 src/posix-io.c | 68 ++++++++++++++++++++++++++++++++--------------------------
 src/verify.c   | 16 +++++++-------
 2 files changed, 45 insertions(+), 39 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list