[Pkg-gnupg-commit] [gnupg2] 114/160: gpgscm: Improve robustness and compatibility.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Jul 15 09:36:42 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch upstream
in repository gnupg2.

commit f26fe4f73e8430d93c03d95a8a24fdabd078bb20
Author: Justus Winter <justus at g10code.com>
Date:   Tue Jul 5 16:24:13 2016 +0200

    gpgscm: Improve robustness and compatibility.
    
    * tests/gpgscm/ffi.c (do_getenv): Avoid gccism.
    (do_mkdtemp): Handle errors.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 tests/gpgscm/ffi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c
index acfe1c7..21beb76 100644
--- a/tests/gpgscm/ffi.c
+++ b/tests/gpgscm/ffi.c
@@ -219,9 +219,11 @@ do_getenv (scheme *sc, pointer args)
 {
   FFI_PROLOG ();
   char *name;
+  char *value;
   FFI_ARG_OR_RETURN (sc, char *, name, string, args);
   FFI_ARGS_DONE_OR_RETURN (sc, args);
-  FFI_RETURN_STRING (sc, getenv (name) ?: "");
+  value = getenv (name);
+  FFI_RETURN_STRING (sc, value ? value : "");
 }
 
 static pointer
@@ -313,6 +315,7 @@ do_mkdtemp (scheme *sc, pointer args)
   FFI_PROLOG ();
   char *template;
   char buffer[128];
+  char *name;
   FFI_ARG_OR_RETURN (sc, char *, template, string, args);
   FFI_ARGS_DONE_OR_RETURN (sc, args);
 
@@ -320,7 +323,10 @@ do_mkdtemp (scheme *sc, pointer args)
     FFI_RETURN_ERR (sc, EINVAL);
   strncpy (buffer, template, sizeof buffer);
 
-  FFI_RETURN_STRING (sc, gnupg_mkdtemp (buffer));
+  name = gnupg_mkdtemp (buffer);
+  if (name == NULL)
+    FFI_RETURN_ERR (sc, gpg_error_from_syserror ());
+  FFI_RETURN_STRING (sc, name);
 }
 
 static pointer

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list