diff options
author | Werner Koch <wk@gnupg.org> | 2010-12-09 13:57:50 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2010-12-09 13:57:50 +0100 |
commit | 3f659600c70b2e9c9b7f9b69e549ede554c34874 (patch) | |
tree | f4d139c51d8a1365042c11f3a7acaafcb0a4c7cb /g10 | |
parent | Change dirmngr timer under W32CE. (diff) | |
download | gnupg2-3f659600c70b2e9c9b7f9b69e549ede554c34874.tar.xz gnupg2-3f659600c70b2e9c9b7f9b69e549ede554c34874.zip |
Change last change. Does now work.
Diffstat (limited to 'g10')
-rw-r--r-- | g10/ChangeLog | 2 | ||||
-rw-r--r-- | g10/tdbio.c | 21 |
2 files changed, 19 insertions, 4 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 669c135ee..0c8cbd418 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -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> diff --git a/g10/tdbio.c b/g10/tdbio.c index 73681af7d..1c775d22d 100644 --- a/g10/tdbio.c +++ b/g10/tdbio.c @@ -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. */ |