From 906da085cf6a15173b1ffdf698159d55fd0d67fe Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 12 Jul 2007 15:25:20 +0000 Subject: [PATCH] Changes for W32 --- assuan/ChangeLog | 5 +++++ assuan/assuan-io.c | 13 +++++++++++-- autogen.sh | 2 +- doc/ChangeLog | 5 +++++ doc/gpgme.texi | 6 +++++- gpgme/ChangeLog | 5 +++++ gpgme/gpgme.h | 2 +- gpgme/version.c | 15 +++++++++++++-- tests/ChangeLog | 5 +++++ tests/gpgsm/t-support.h | 2 ++ 10 files changed, 53 insertions(+), 7 deletions(-) diff --git a/assuan/ChangeLog b/assuan/ChangeLog index 0df0a794..9bad1ee2 100644 --- a/assuan/ChangeLog +++ b/assuan/ChangeLog @@ -1,3 +1,8 @@ +2007-07-12 Werner Koch + + * assuan-io.c (_assuan_simple_write, _assuan_simple_read): Map + ERROR_BROKEN_PIPE to EPIPE. + 2007-07-08 Marcus Brinkmann * assuan-defs.h (struct assuan_context_s): Have partial peercred diff --git a/assuan/assuan-io.c b/assuan/assuan-io.c index 6d895791..066231fb 100644 --- a/assuan/assuan-io.c +++ b/assuan/assuan-io.c @@ -65,7 +65,11 @@ _assuan_simple_read (assuan_context_t ctx, void *buffer, size_t size) n = ReadFile ((HANDLE)ctx->inbound.fd, buffer, size, &nread, NULL); if (!n) { - errno = EIO; /* FIXME: We should have a proper mapping. */ + switch (GetLastError()) + { + case ERROR_BROKEN_PIPE: errno = EPIPE; break; + default: errno = EIO; + } n = -1; } else @@ -94,7 +98,12 @@ _assuan_simple_write (assuan_context_t ctx, const void *buffer, size_t size) n = WriteFile ((HANDLE)ctx->outbound.fd, buffer, size, &nwrite, NULL); if (!n) { - errno = EIO; /* FIXME: We should have a proper mapping. */ + switch (GetLastError ()) + { + case ERROR_BROKEN_PIPE: + case ERROR_NO_DATA: errno = EPIPE; break; + default: errno = EIO; break; + } n = -1; } else diff --git a/autogen.sh b/autogen.sh index fc61c5f3..ffe46b4d 100755 --- a/autogen.sh +++ b/autogen.sh @@ -80,7 +80,7 @@ if test "$1" = "--build-w32"; then ./configure --enable-maintainer-mode --prefix=${w32root} \ --host=i586-mingw32msvc --build=${build} \ - --with-gpg-error-prefix=${w32root} --without-gpgsm \ + --with-gpg-error-prefix=${w32root} \ --enable-shared --enable-static --enable-w32-glib \ PKG_CONFIG_LIBDIR="$w32root/lib/pkgconfig" diff --git a/doc/ChangeLog b/doc/ChangeLog index 2b5f5001..1109437b 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2007-07-12 Werner Koch + + * gpgme.texi (Library Version Check): Add remark that the socket + layer will get initialized. + 2007-06-05 Marcus Brinkmann * gpgme.texi (Advanced Key Editing): New section. diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 5c56046d..61db9cf8 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -572,7 +572,11 @@ can verify that the version number is higher than a certain required version number. In either case, the function initializes some sub-systems, and for this reason alone it must be invoked early in your program, before you make use of the other functions in -@acronym{GPGME}. +@acronym{GPGME}. + +As a side effect for W32 based systems, the socket layer will get +initialized. + If @var{required_version} is @code{NULL}, the function returns a pointer to a statically allocated string containing the version number diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index d2b021d6..43e41451 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,8 @@ +2007-07-12 Werner Koch + + * version.c (do_subsystem_inits) [W32]: Make sure that the socket + system has been started. + 2007-07-10 Marcus Brinkmann * priv-io.h (_gpgme_io_dup): New prototype. diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h index 41e74914..666041b4 100644 --- a/gpgme/gpgme.h +++ b/gpgme/gpgme.h @@ -72,7 +72,7 @@ extern "C" { AM_PATH_GPGME macro) check that this header matches the installed library. Warning: Do not edit the next line. configure will do that for you! */ -#define GPGME_VERSION "1.1.5-cvs1219" +#define GPGME_VERSION "1.1.5-cvs1228" diff --git a/gpgme/version.c b/gpgme/version.c index a54c0d4d..ad893d84 100644 --- a/gpgme/version.c +++ b/gpgme/version.c @@ -25,6 +25,9 @@ #include #include #include +#ifdef HAVE_W32_SYSTEM +#include +#endif #include "gpgme.h" #include "priv-io.h" @@ -41,7 +44,7 @@ must be done once at startup. We can not guarantee this using a lock, though, because the semaphore subsystem needs to be initialized itself before it can be used. So we expect that the - user performs the necessary syncrhonization. */ + user performs the necessary synchronization. */ static void do_subsystem_inits (void) { @@ -54,7 +57,15 @@ do_subsystem_inits (void) _gpgme_io_subsystem_init (); #ifdef HAVE_ASSUAN_H assuan_set_assuan_err_source (GPG_ERR_SOURCE_GPGME); -#endif +#ifdef HAVE_W32_SYSTEM + /* We need to make sure that the sockets are initialized. */ + { + WSADATA wsadat; + + WSAStartup (0x202, &wsadat); + } +#endif /*HAVE_W32_SYSTEM*/ +#endif /*HAVE_ASSUAN_H*/ done = 1; } diff --git a/tests/ChangeLog b/tests/ChangeLog index f83207fd..48a41c24 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2007-07-12 Werner Koch + + * gpgsm/t-support.h (init_gpgme) [W32]: Do not init the locales as + the constants are not available. + 2007-02-26 Werner Koch * gpg/t-verify.c (double_plaintext_sig): New. diff --git a/tests/gpgsm/t-support.h b/tests/gpgsm/t-support.h index 671317ff..07f00c38 100644 --- a/tests/gpgsm/t-support.h +++ b/tests/gpgsm/t-support.h @@ -91,9 +91,11 @@ init_gpgme (gpgme_protocol_t proto) gpgme_error_t err; gpgme_check_version (NULL); +#ifndef HAVE_W32_SYSTEM setlocale (LC_ALL, ""); gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL)); +#endif err = gpgme_engine_check_version (proto); fail_if_err (err);