g10: Write first keybox record in binary mode
authorAndre Heinecke <aheinecke@intevation.de>
Fri, 21 Oct 2016 12:59:26 +0000 (14:59 +0200)
committerAndre Heinecke <aheinecke@intevation.de>
Fri, 21 Oct 2016 13:02:19 +0000 (15:02 +0200)
* g10/keydb.c (maybe_create_keyring_or_box): Open in binary mode.

--
This fixes keybox corruption on windows.

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
g10/keydb.c

index e49e25f..b959f05 100644 (file)
@@ -415,7 +415,7 @@ maybe_create_keyring_or_box (char *filename, int is_box, int force_create)
      that the detection magic will work the next time it is used.  */
   if (is_box)
     {
-      FILE *fp = fopen (filename, "w");
+      FILE *fp = fopen (filename, "wb");
       if (!fp)
         rc = gpg_error_from_syserror ();
       else