[git] GPGME - branch, master, updated. gpgme-1.10.0-2-g37d62e9

by NIIBE Yutaka cvs at cvs.gnupg.org
Mon Jan 29 03:48:17 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 "GnuPG Made Easy".

The branch, master has been updated
       via  37d62e9d0f685c257fdb5f303e60ff01f8a36a2f (commit)
      from  7da01c7352d41eb33e445968b248544d301588f9 (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 37d62e9d0f685c257fdb5f303e60ff01f8a36a2f
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Mon Jan 29 11:45:33 2018 +0900

    core: Implement _gpgme_getenv for NetBSD.
    
    * src/get-env.c [HAVE_GETENV_R] (_gpgme_getenv): New.
    
    --
    
    GnuPG-bug-id: 3056
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/src/get-env.c b/src/get-env.c
index 57fd419..9e2df68 100644
--- a/src/get-env.c
+++ b/src/get-env.c
@@ -28,7 +28,7 @@
 #include "util.h"
 
 

-#if defined(HAVE_THREAD_SAFE_GETENV) || !defined (HAVE_GETENV_R)
+#if defined(HAVE_THREAD_SAFE_GETENV)
 /* We prefer using getenv() if it is thread-safe.  */
 
 /* Retrieve the environment variable NAME and return a copy of it in a
@@ -50,7 +50,46 @@ _gpgme_getenv (const char *name, char **value)
     }
   return 0;
 }
+#elif defined (HAVE_GETENV_R)
+#define INITIAL_GETENV_SIZE 32
 
+gpgme_error_t
+_gpgme_getenv (const char *name, char **value)
+{
+  size_t len = INITIAL_GETENV_SIZE;
+  char *env_value;
+
+  env_value = malloc (len);
+
+  while (1)
+    {
+      *value = env_value;
+      if (!env_value)
+        return gpg_error_from_syserror ();
+
+      if (getenv_r (name, env_value, len) == 0)
+        break;
+
+      if (errno == ERANGE)
+        {
+          len *= 2;
+          env_value = realloc (env_value, len);
+        }
+      else
+        {
+          int saved = errno;
+
+          free (env_value);
+          *value = NULL;
+          if (errno == ENOENT)
+            return 0;
+          else
+          return gpg_error_from_errno (saved);
+        }
+    }
+
+  return 0;
+}
 #else
 
 /* FIXME: Implement this when we have the specification for it.  */

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

Summary of changes:
 src/get-env.c | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)


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




More information about the Gnupg-commits mailing list