[svn] GnuPG - r5496 - trunk/g10

svn author wk cvs at cvs.gnupg.org
Thu Dec 9 13:57:51 CET 2010


Author: wk
Date: 2010-12-09 13:57:50 +0100 (Thu, 09 Dec 2010)
New Revision: 5496

Modified:
   trunk/g10/ChangeLog
   trunk/g10/tdbio.c
Log:
Change last change.  Does now work.


Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2010-12-09 11:50:22 UTC (rev 5495)
+++ trunk/g10/ChangeLog	2010-12-09 12:57:50 UTC (rev 5496)
@@ -2,7 +2,7 @@
 
 	* tdbio.c (tdbio_set_dbname) [W32CE]: Take care of missing errno.
 	(strerror) [W32CE]: Dummy replacement.
-	(open_db) [W32CE]: Fall back to read-only on any error.
+	(open_db) [W32CE]: Use CreateFile.
 
 2010-12-02  Werner Koch  <wk at g10code.com>
 

Modified: trunk/g10/tdbio.c
===================================================================
--- trunk/g10/tdbio.c	2010-12-09 11:50:22 UTC (rev 5495)
+++ trunk/g10/tdbio.c	2010-12-09 12:57:50 UTC (rev 5496)
@@ -615,22 +615,37 @@
   if (make_dotlock( lockhandle, -1 ) )
     log_fatal( _("can't lock `%s'\n"), db_name );
 #endif /* __riscos__ */
+#ifdef HAVE_W32CE_SYSTEM
+  {
+    DWORD prevrc = 0;
+    wchar_t *wname = utf8_to_wchar (db_name);
+    if (wname)
+      {
+        db_fd = (int)CreateFile (wname, GENERIC_READ|GENERIC_WRITE,
+                                 FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
+                                 OPEN_EXISTING, 0, NULL);
+        xfree (wname);
+      }
+    if (db_fd == -1)
+      log_fatal ("can't open `%s': %d, %d\n", db_name,
+                 (int)prevrc, (int)GetLastError ());
+  }
+#else /*!HAVE_W32CE_SYSTEM*/
   db_fd = open (db_name, O_RDWR | MY_O_BINARY );
   if (db_fd == -1 && (errno == EACCES
 #ifdef EROFS
                       || errno == EROFS
 #endif
-#ifdef HAVE_W32CE_SYSTEM
-                      || 1 /* cegcc's open does not set ERRNO. */
-#endif
                       )
       ) {
+      /* Take care of read-only trustdbs.  */
       db_fd = open (db_name, O_RDONLY | MY_O_BINARY );
       if (db_fd != -1)
           log_info (_("NOTE: trustdb not writable\n"));
   }
   if ( db_fd == -1 )
     log_fatal( _("can't open `%s': %s\n"), db_name, strerror(errno) );
+#endif /*!HAVE_W32CE_SYSTEM*/
   register_secured_file (db_name);
 
   /* Read the version record. */





More information about the Gnupg-commits mailing list