1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

Change last change. Does now work.

This commit is contained in:
Werner Koch 2010-12-09 12:57:50 +00:00
parent 1486dec17b
commit 3f659600c7
2 changed files with 19 additions and 4 deletions

View File

@ -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@g10code.com>

View File

@ -615,22 +615,37 @@ open_db()
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. */