[svn] gpgme - r1322 - trunk/gpgme

svn author wk cvs at cvs.gnupg.org
Thu Jun 26 16:38:40 CEST 2008


Author: wk
Date: 2008-06-26 16:38:39 +0200 (Thu, 26 Jun 2008)
New Revision: 1322

Modified:
   trunk/gpgme/ChangeLog
   trunk/gpgme/w32-util.c
Log:
Fix incompatibility with non-recent mingw runtimes.


Modified: trunk/gpgme/ChangeLog
===================================================================
--- trunk/gpgme/ChangeLog	2008-06-25 16:52:31 UTC (rev 1321)
+++ trunk/gpgme/ChangeLog	2008-06-26 14:38:39 UTC (rev 1322)
@@ -1,3 +1,9 @@
+2008-06-26  Werner Koch  <wk at g10code.com>
+
+	* w32-util.c (_gpgme_mkstemp): Replace sprint by stpcpy.
+	(mkstemp): Need to use GetSystemTimeAsFileTime for better
+	compatibility.
+
 2008-06-25  Marcus Brinkmann  <marcus at g10code.de>
 
 	* gpgme-w32spawn.c: New file.

Modified: trunk/gpgme/w32-util.c
===================================================================
--- trunk/gpgme/w32-util.c	2008-06-25 16:52:31 UTC (rev 1321)
+++ trunk/gpgme/w32-util.c	2008-06-26 14:38:39 UTC (rev 1322)
@@ -470,9 +470,11 @@
 
   /* Get some more or less random data.  */
   {
-    struct timeval tv;
-    gettimeofday (&tv, NULL);
-    random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec;
+    FILETIME ft;
+
+    GetSystemTimeAsFileTime (&ft);
+    random_time_bits = (((uint64_t)ft.dwHighDateTime << 32)
+                        | (uint64_t)ft.dwLowDateTime);
   }
   value += random_time_bits ^ getpid ();
 
@@ -537,7 +539,7 @@
   tmpname = malloc (strlen (tmp) + 13 + 1);
   if (!tmpname)
     return -1;
-  sprintf (tmpname, "%s\\gpgme-XXXXXX", tmp);
+  strcpy (stpcpy (tmpname, tmp), "\\gpgme-XXXXXX");
   *fd = mkstemp (tmpname);
   if (fd < 0)
     return -1;




More information about the Gnupg-commits mailing list