[git] GPGME - branch, master, updated. gpgme-1.9.0-64-g3244d4d

by Marcus Brinkmann cvs at cvs.gnupg.org
Wed Aug 16 01:52:03 CEST 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  3244d4daff892d5d3c39e78f4eb0934379beda2c (commit)
      from  97a1abe72e73f85bbf922fa588d002a226db5459 (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 3244d4daff892d5d3c39e78f4eb0934379beda2c
Author: Marcus Brinkmann <marcus.brinkmann at ruhr-uni-bochum.de>
Date:   Wed Aug 16 01:50:00 2017 +0200

    gpgconf: Fix some warnings.
    
    * tests/gpg/t-gpgconf.c (main): Fix warnings.
    * src/engine-gpgconf.c (struct gpgconf_config_dir_s): New struct.
    (gpgconf_config_dir_cb, gpgconf_conf_dir) Use it to fix warning.
    
    Signed-off-by: Marcus Brinkmann <mb at g10code.com>

diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c
index 2b0f448..84d8df7 100644
--- a/src/engine-gpgconf.c
+++ b/src/engine-gpgconf.c
@@ -986,20 +986,25 @@ gpgconf_conf_save (void *engine, gpgme_conf_comp_t comp)
 }
 
 
+struct gpgconf_config_dir_s
+{
+  const char *what;
+  char *result;
+};
+
 static gpgme_error_t
 gpgconf_config_dir_cb (void *hook, char *line)
 {
   /* This is an input- and output-parameter.  */
-  char **str_p = (char **) hook;
-  char *what = *str_p;
-  int len = strlen(what);
+  struct gpgconf_config_dir_s *data = (char **) hook;
+  int len = strlen(data->what);
 
-  if (!strncmp(line, what, len) && line[len] == ':')
+  if (!strncmp(line, data->what, len) && line[len] == ':')
     {
       char *result = strdup(&line[len + 1]);
       if (!result)
 	return gpg_error_from_syserror ();
-      *str_p = result;
+      data->result = result;
       return gpg_error(GPG_ERR_USER_1);
     }
   return 0;
@@ -1010,15 +1015,16 @@ static gpgme_error_t
 gpgconf_conf_dir (void *engine, const char *what, char **result)
 {
   gpgme_error_t err;
-  char *res = what;
+  struct gpgconf_config_dir_s data;
 
-  *result = NULL;
+  data.what = what;
+  data.result = NULL;
   err = gpgconf_read (engine, "--list-dirs", NULL,
-		      gpgconf_config_dir_cb, &res);
+		      gpgconf_config_dir_cb, &data);
   if (gpg_err_code (err) == GPG_ERR_USER_1)
     {
       /* This signals to use that a result was found.  */
-      *result = res;
+      *result = data.result;
       return 0;
     }
 
diff --git a/tests/gpg/t-gpgconf.c b/tests/gpg/t-gpgconf.c
index 8c81de6..5eccede 100644
--- a/tests/gpg/t-gpgconf.c
+++ b/tests/gpg/t-gpgconf.c
@@ -263,22 +263,25 @@ main (void)
   err = gpgme_new (&ctx);
   fail_if_err (err);
 
-  /* Let's check getting the agent-socket directory for different homedirs.  */
-  char *result1 = NULL;
-  err = gpgme_ctx_set_engine_info (ctx, GPGME_PROTOCOL_GPGCONF, NULL, "/tmp/foo");
-  fail_if_err (err);
-  err = gpgme_op_conf_dir (ctx, "agent-socket", &result1);
-  fail_if_err (err);
-
-  char *result2 = NULL;
-  err = gpgme_ctx_set_engine_info (ctx, GPGME_PROTOCOL_GPGCONF, NULL, NULL);
-  fail_if_err (err);
-  err = gpgme_op_conf_dir (ctx, "agent-socket", &result2);
-  fail_if_err (err);
+  {
+    /* Let's check getting the agent-socket directory for different homedirs.  */
+    char *result1 = NULL;
+    char *result2 = NULL;
+    err = gpgme_ctx_set_engine_info (ctx, GPGME_PROTOCOL_GPGCONF, NULL, "/tmp/foo");
+    fail_if_err (err);
+    err = gpgme_op_conf_dir (ctx, "agent-socket", &result1);
+    fail_if_err (err);
 
-  /* They have to be different.  */
-  test (strcmp(result1, result2));
+    err = gpgme_ctx_set_engine_info (ctx, GPGME_PROTOCOL_GPGCONF, NULL, NULL);
+    fail_if_err (err);
+    err = gpgme_op_conf_dir (ctx, "agent-socket", &result2);
+    fail_if_err (err);
 
+    /* They have to be different.  */
+    test (strcmp(result1, result2));
+    gpgme_free (result1);
+    gpgme_free (result2);
+  }
 
   err = gpgme_op_conf_load (ctx, &conf);
   fail_if_err (err);

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

Summary of changes:
 src/engine-gpgconf.c  | 24 +++++++++++++++---------
 tests/gpg/t-gpgconf.c | 31 +++++++++++++++++--------------
 2 files changed, 32 insertions(+), 23 deletions(-)


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




More information about the Gnupg-commits mailing list