aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--g10/ChangeLog6
-rw-r--r--g10/tdbio.c17
2 files changed, 23 insertions, 0 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 0af97c45e..669c135ee 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,9 @@
+2010-12-09 Werner Koch <[email protected]>
+
+ * 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.
+
2010-12-02 Werner Koch <[email protected]>
* misc.c (openpgp_cipher_algo_name): Use gnupg_cipher_algo_name.
diff --git a/g10/tdbio.c b/g10/tdbio.c
index f967742c3..73681af7d 100644
--- a/g10/tdbio.c
+++ b/g10/tdbio.c
@@ -48,6 +48,13 @@
#define MY_O_BINARY 0
#endif
+/* We use ERRNO despite that the cegcc provided open/read/write
+ functions don't set ERRNO - at least show that ERRNO does not make
+ sense. */
+#ifdef HAVE_W32CE_SYSTEM
+#undef strerror
+#define strerror(a) ("[errno not available]")
+#endif
/****************
* Yes, this is a very simple implementation. We should really
@@ -494,6 +501,13 @@ tdbio_set_dbname( const char *new_dbname, int create )
fname = xstrdup (new_dbname);
if( access( fname, R_OK ) ) {
+#ifdef HAVE_W32CE_SYSTEM
+ /* We know how the cegcc implementation of access works ;-). */
+ if (GetLastError () == ERROR_FILE_NOT_FOUND)
+ gpg_err_set_errno (ENOENT);
+ else
+ gpg_err_set_errno (EIO);
+#endif /*HAVE_W32CE_SYSTEM*/
if( errno != ENOENT ) {
log_error( _("can't access `%s': %s\n"), fname, strerror(errno) );
xfree(fname);
@@ -606,6 +620,9 @@ open_db()
#ifdef EROFS
|| errno == EROFS
#endif
+#ifdef HAVE_W32CE_SYSTEM
+ || 1 /* cegcc's open does not set ERRNO. */
+#endif
)
) {
db_fd = open (db_name, O_RDONLY | MY_O_BINARY );