[git] GnuPG - branch, master, updated. gnupg-2.1.1-14-g628b111

by Daniel Kahn Gillmor cvs at cvs.gnupg.org
Mon Dec 22 12:56:46 CET 2014


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  628b111fa679612e23c0d46505b1ecbbf091897d (commit)
       via  351bca9047d748c3c4f7e9a3cdc476af127b1da3 (commit)
      from  6056d2467310260ddc0db2fe65b737ace6febcaa (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 628b111fa679612e23c0d46505b1ecbbf091897d
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Fri Dec 19 17:12:37 2014 -0500

    avoid double-close in unusual dotlock situations
    
    * common/dotlock.c: (dotlock_create_unix) avoid double-close()
     in unusual situations.
    
    --
    
    close(2) says:
    
     close() should not be retried after an EINTR since this  may
           cause a reused descriptor from another thread to be closed.
    
    Before this patch was applied, if close(fd) failed with EINTR, it
    would be closed again in the write_failed: block.
    
    It could also have been closed a second time in the case that
    (use_hardlinks_p (h->tname)) evaluated to something other than 0 or 1.
    
    This patch avoids both of those scenarios.
    
    Note that close() could still be called twice on the same file
    descriptor if the first close(fd) fails but errno is not EINTR.  I'm
    not sure the right thing to do in that scenario.  An alternate
    resolution could be to unequivocally set fd to -1 after the first
    failed close(fd), avoiding the errno == EINTR test.
    
    Debian-Bug-Id: 773423

diff --git a/common/dotlock.c b/common/dotlock.c
index c5520db..a9963d1 100644
--- a/common/dotlock.c
+++ b/common/dotlock.c
@@ -680,7 +680,12 @@ dotlock_create_unix (dotlock_t h, const char *file_to_lock)
   if ( write (fd, "\n", 1 ) != 1 )
     goto write_failed;
   if ( close (fd) )
-    goto write_failed;
+    {
+      if ( errno == EINTR )
+        fd = -1;
+      goto write_failed;
+    }
+  fd = -1;
 
   /* Check whether we support hard links.  */
   switch (use_hardlinks_p (h->tname))
@@ -718,7 +723,8 @@ dotlock_create_unix (dotlock_t h, const char *file_to_lock)
   all_lockfiles = h->next;
   UNLOCK_all_lockfiles ();
   my_error_2 (_("error writing to '%s': %s\n"), h->tname, strerror (errno));
-  close (fd);
+  if ( fd != -1 )
+    close (fd);
   unlink (h->tname);
   jnlib_free (h->tname);
   jnlib_free (h);

commit 351bca9047d748c3c4f7e9a3cdc476af127b1da3
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Fri Dec 19 17:12:05 2014 -0500

    gpgkey2ssh: clean up varargs
    
    * tools/gpgkey2ssh.c (key_to_blob) : ensure that va_end is called.
    
    --
    
    stdarg(3) says:
           Each invocation of va_start() must be matched by a
           corresponding invocation of va_end() in the same function.
    
    Observed by Joshua Rogers <honey at internot.info>
    
    Debian-Bug-Id: 773415

diff --git a/tools/gpgkey2ssh.c b/tools/gpgkey2ssh.c
index 903fb5b..d22c5ac 100644
--- a/tools/gpgkey2ssh.c
+++ b/tools/gpgkey2ssh.c
@@ -224,6 +224,8 @@ key_to_blob (unsigned char **blob, size_t *blob_n, const char *identifier, ...)
       assert (ret == 1);
     }
 
+  va_end (ap);
+
   blob_new_n = ftell (stream);
   rewind (stream);
 

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

Summary of changes:
 common/dotlock.c   |   10 ++++++++--
 tools/gpgkey2ssh.c |    2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)


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




More information about the Gnupg-commits mailing list