[git] GnuPG - branch, master, updated. gnupg-2.1.13-57-g4819f68

by Justus Winter cvs at cvs.gnupg.org
Tue Jun 28 15:14:29 CEST 2016


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  4819f687c48c7972c39ae29c7af1e891a4d57360 (commit)
       via  d36f664bfdc39c05927cb6e14fe1b3ecb7b64bfa (commit)
       via  8f79c31b4d465eeaf81c8046c35bb8c34512dd8d (commit)
      from  52f65281f9743c42a48bf5a3354c9ab0ecdb681a (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 4819f687c48c7972c39ae29c7af1e891a4d57360
Author: Justus Winter <justus at g10code.com>
Date:   Tue Jun 28 15:03:07 2016 +0200

    tools/gpgtar: Fix handling of '-'.
    
    * tools/gpgtar-extract.c (gpgtar_extract): Use stdin if file is '-'.
    * tools/gpgtar-list.c (gpgtar_list): Likewise.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tools/gpgtar-extract.c b/tools/gpgtar-extract.c
index 866215b..cee609c 100644
--- a/tools/gpgtar-extract.c
+++ b/tools/gpgtar-extract.c
@@ -282,7 +282,7 @@ gpgtar_extract (const char *filename, int decrypt)
   if (filename)
     {
       if (!strcmp (filename, "-"))
-        stream = es_stdout;
+        stream = es_stdin;
       else
         stream = es_fopen (filename, "rb");
       if (!stream)
diff --git a/tools/gpgtar-list.c b/tools/gpgtar-list.c
index 1d59d9c..cb2e700 100644
--- a/tools/gpgtar-list.c
+++ b/tools/gpgtar-list.c
@@ -282,7 +282,7 @@ gpgtar_list (const char *filename, int decrypt)
   if (filename)
     {
       if (!strcmp (filename, "-"))
-        stream = es_stdout;
+        stream = es_stdin;
       else
         stream = es_fopen (filename, "rb");
       if (!stream)

commit d36f664bfdc39c05927cb6e14fe1b3ecb7b64bfa
Author: Justus Winter <justus at g10code.com>
Date:   Tue Jun 28 15:01:57 2016 +0200

    common: Close input stream.
    
    * common/exechelp-posix.c (gnupg_spawn_process): Also close the input
    stream in the child.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/common/exechelp-posix.c b/common/exechelp-posix.c
index aefb653..b1b56f3 100644
--- a/common/exechelp-posix.c
+++ b/common/exechelp-posix.c
@@ -523,6 +523,7 @@ gnupg_spawn_process (const char *pgmname, const char *argv[],
     {
       /* This is the child. */
       gcry_control (GCRYCTL_TERM_SECMEM);
+      es_fclose (infp);
       es_fclose (outfp);
       es_fclose (errfp);
       do_exec (pgmname, argv, inpipe[0], outpipe[1], errpipe[1],

commit 8f79c31b4d465eeaf81c8046c35bb8c34512dd8d
Author: Justus Winter <justus at g10code.com>
Date:   Tue Jun 28 14:38:35 2016 +0200

    common: Fix copying data from the spawned child.
    
    Fixes intermittent gpgtar failures.
    
    * common/exectool.c (copy_buffer_do_copy): Initialize 'nwritten'.
    (gnupg_exec_tool_stream): Loop until all data is copied.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/common/exectool.c b/common/exectool.c
index 897450e..b43e7cb 100644
--- a/common/exectool.c
+++ b/common/exectool.c
@@ -224,7 +224,7 @@ static gpg_error_t
 copy_buffer_do_copy (struct copy_buffer *c, estream_t source, estream_t sink)
 {
   gpg_error_t err;
-  size_t nwritten;
+  size_t nwritten = 0;
 
   if (c->nread == 0)
     {
@@ -390,7 +390,7 @@ gnupg_exec_tool_stream (const char *pgmname, const char *argv[],
   /* Now read as long as we have something to poll.  We continue
      reading even after EOF or error on stdout so that we get the
      other error messages or remaining outut.  */
-  while (!fds[1].ignore && !fds[2].ignore)
+  while (! (fds[1].ignore && fds[2].ignore))
     {
       count = es_poll (fds, DIM(fds), -1);
       if (count == -1)
@@ -465,20 +465,25 @@ gnupg_exec_tool_stream (const char *pgmname, const char *argv[],
                          pgmname, gpg_strerror (err));
               goto leave;
             }
+
+          if (es_feof (fds[1].stream))
+            {
+              err = copy_buffer_flush (&cpbuf_out, output);
+              if (err)
+                {
+                  log_error ("error reading data from '%s': %s\n",
+                             pgmname, gpg_strerror (err));
+                  goto leave;
+                }
+
+              fds[1].ignore = 1; /* ready.  */
+            }
         }
 
       if (fds[2].got_read)
         read_and_log_stderr (&fderrstate, fds + 2);
     }
 
-  err = copy_buffer_flush (&cpbuf_out, output);
-  if (err)
-    {
-      log_error ("error reading data from '%s': %s\n",
-                 pgmname, gpg_strerror (err));
-      goto leave;
-    }
-
   read_and_log_stderr (&fderrstate, NULL); /* Flush.  */
   es_fclose (infp); infp = NULL;
   es_fclose (extrafp); extrafp = NULL;

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

Summary of changes:
 common/exechelp-posix.c |  1 +
 common/exectool.c       | 25 +++++++++++++++----------
 tools/gpgtar-extract.c  |  2 +-
 tools/gpgtar-list.c     |  2 +-
 4 files changed, 18 insertions(+), 12 deletions(-)


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




More information about the Gnupg-commits mailing list