From 8a322a05b78de88d1d9d05a739943bfec74a51cf Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 12 Jul 2007 15:25:20 +0000 Subject: [PATCH] Changes for W32 --- trunk/assuan/ChangeLog | 5 +++++ trunk/assuan/assuan-io.c | 13 +++++++++++-- trunk/autogen.sh | 2 +- trunk/doc/ChangeLog | 5 +++++ trunk/doc/gpgme.texi | 6 +++++- trunk/gpgme/ChangeLog | 5 +++++ trunk/gpgme/gpgme.h | 2 +- trunk/gpgme/version.c | 15 +++++++++++++-- trunk/tests/ChangeLog | 5 +++++ trunk/tests/gpgsm/t-support.h | 2 ++ 10 files changed, 53 insertions(+), 7 deletions(-) diff --git a/trunk/assuan/ChangeLog b/trunk/assuan/ChangeLog index 0df0a79..9bad1ee 100644 --- a/trunk/assuan/ChangeLog +++ b/trunk/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/trunk/assuan/assuan-io.c b/trunk/assuan/assuan-io.c index 6d89579..066231f 100644 --- a/trunk/assuan/assuan-io.c +++ b/trunk/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/trunk/autogen.sh b/trunk/autogen.sh index fc61c5f..ffe46b4 100755 --- a/trunk/autogen.sh +++ b/trunk/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/trunk/doc/ChangeLog b/trunk/doc/ChangeLog index 2b5f500..1109437 100644 --- a/trunk/doc/ChangeLog +++ b/trunk/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/trunk/doc/gpgme.texi b/trunk/doc/gpgme.texi index 5c56046..61db9cf 100644 --- a/trunk/doc/gpgme.texi +++ b/trunk/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/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index d2b021d..43e4145 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/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/trunk/gpgme/gpgme.h b/trunk/gpgme/gpgme.h index 41e7491..666041b 100644 --- a/trunk/gpgme/gpgme.h +++ b/trunk/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/trunk/gpgme/version.c b/trunk/gpgme/version.c index a54c0d4..ad893d8 100644 --- a/trunk/gpgme/version.c +++ b/trunk/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/trunk/tests/ChangeLog b/trunk/tests/ChangeLog index f83207f..48a41c2 100644 --- a/trunk/tests/ChangeLog +++ b/trunk/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/trunk/tests/gpgsm/t-support.h b/trunk/tests/gpgsm/t-support.h index 671317f..07f00c3 100644 --- a/trunk/tests/gpgsm/t-support.h +++ b/trunk/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); -- 2.26.2