From 1486dec17bfb4b60f49da2ea7a342abef33f2201 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 9 Dec 2010 11:50:22 +0000 Subject: [PATCH] Change dirmngr timer under W32CE. Fix trustdb open problem under W32CE. --- dirmngr/ChangeLog | 4 ++++ dirmngr/dirmngr.c | 12 ++++++++---- g10/ChangeLog | 6 ++++++ g10/tdbio.c | 17 +++++++++++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/dirmngr/ChangeLog b/dirmngr/ChangeLog index d840ed43f..67a51b005 100644 --- a/dirmngr/ChangeLog +++ b/dirmngr/ChangeLog @@ -1,3 +1,7 @@ +2010-12-07 Werner Koch + + * dirmngr.c (TIMERTICK_INTERVAL) [W32CE]: Change to 60s. + 2010-11-23 Werner Koch * Makefile.am (dirmngr_LDFLAGS): Add extra_bin_ldflags. diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index 9525e2e12..966c657d0 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -241,11 +241,15 @@ static int active_connections; /* The timer tick used for housekeeping stuff. For Windows we use a longer period as the SetWaitableTimer seems to signal earlier than - the 2 seconds. */ -#ifdef HAVE_W32_SYSTEM -#define TIMERTICK_INTERVAL (4) + the 2 seconds. CHECK_OWN_SOCKET_INTERVAL defines how often we + check our own socket in standard socket mode. If that value is 0 + we don't check at all. All values are in seconds. */ +#if defined(HAVE_W32CE_SYSTEM) +# define TIMERTICK_INTERVAL (60) +#elif defined(HAVE_W32_SYSTEM) +# define TIMERTICK_INTERVAL (4) #else -#define TIMERTICK_INTERVAL (2) /* Seconds. */ +# define TIMERTICK_INTERVAL (2) #endif /* This union is used to avoid compiler warnings in case a pointer is 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 + + * 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 * 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); @@ -605,6 +619,9 @@ open_db() if (db_fd == -1 && (errno == EACCES #ifdef EROFS || errno == EROFS +#endif +#ifdef HAVE_W32CE_SYSTEM + || 1 /* cegcc's open does not set ERRNO. */ #endif ) ) {