[git] GnuPG - branch, master, updated. gnupg-2.1.15-256-g1ffd475

by NIIBE Yutaka cvs at cvs.gnupg.org
Fri Oct 21 04:00:21 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  1ffd475f99eaff4e40950eda88702f8db9288eb5 (commit)
      from  71158d8d5f823888abc8588caa6497860ce59c06 (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 1ffd475f99eaff4e40950eda88702f8db9288eb5
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Fri Oct 21 10:57:29 2016 +0900

    agent: Fix saving with FORCE=1.
    
    * agent/findkey.c (agent_write_private_key): Recover from an error of
    GPG_ERR_ENOENT when FORCE=1 and it is opened with "rb+".
    
    --
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/agent/findkey.c b/agent/findkey.c
index 23e94f0..162e8c2 100644
--- a/agent/findkey.c
+++ b/agent/findkey.c
@@ -152,17 +152,30 @@ agent_write_private_key (const unsigned char *grip,
   if (!fp)
     {
       gpg_error_t tmperr = gpg_error_from_syserror ();
-      log_error ("can't create '%s': %s\n", fname, gpg_strerror (tmperr));
-      xfree (fname);
-      return tmperr;
-    }
 
-  /* See if an existing key is in extended format.  */
-  if (force)
+      if (force && gpg_err_code (tmperr) == GPG_ERR_ENOENT)
+        {
+          fp = es_fopen (fname, "wbx,mode=-rw");
+          if (!fp)
+            {
+              tmperr = gpg_error_from_syserror ();
+              goto error;
+            }
+        }
+      else
+        {
+        error:
+          log_error ("can't create '%s': %s\n", fname, gpg_strerror (tmperr));
+          xfree (fname);
+          return tmperr;
+        }
+    }
+  else if (force)
     {
       gpg_error_t rc;
       char first;
 
+      /* See if an existing key is in extended format.  */
       if (es_fread (&first, 1, 1, fp) != 1)
         {
           rc = gpg_error_from_syserror ();

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

Summary of changes:
 agent/findkey.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)


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




More information about the Gnupg-commits mailing list