diff options
author | Werner Koch <wk@gnupg.org> | 2008-04-21 21:13:36 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2008-04-21 21:13:36 +0200 |
commit | 08a612f26e7657daf7adb39cc62b91ab76e488fb (patch) | |
tree | c2f33a0073571cd5d47dc42a777f855cc75384a1 /common | |
parent | Use default PIN flag (diff) | |
download | gnupg2-08a612f26e7657daf7adb39cc62b91ab76e488fb.tar.xz gnupg2-08a612f26e7657daf7adb39cc62b91ab76e488fb.zip |
W32 related keyserver fixes.
Diffstat (limited to 'common')
-rw-r--r-- | common/ChangeLog | 6 | ||||
-rw-r--r-- | common/http.c | 16 | ||||
-rw-r--r-- | common/i18n.c | 2 |
3 files changed, 22 insertions, 2 deletions
diff --git a/common/ChangeLog b/common/ChangeLog index 3cc542682..943b9f033 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -1,3 +1,9 @@ +2008-04-21 Werner Koch <wk@g10code.com> + + * http.c (http_wait_response) [W32]: Use DuplicateHandle because + it is a socket. + (cookie_read) [W32]: Use recv in place of read. + 2008-04-08 Werner Koch <wk@g10code.com> * i18n.c (i18n_switchto_utf8, i18n_switchback) diff --git a/common/http.c b/common/http.c index 5f7c053fd..4dda27a2c 100644 --- a/common/http.c +++ b/common/http.c @@ -396,7 +396,16 @@ http_wait_response (http_t hd) else #endif /*HTTP_USE_ESTREAM*/ { +#ifdef HAVE_W32_SYSTEM + HANDLE handle = (HANDLE)hd->sock; + if (!DuplicateHandle (GetCurrentProcess(), handle, + GetCurrentProcess(), &handle, 0, + TRUE, DUPLICATE_SAME_ACCESS )) + return gpg_error_from_syserror (); + hd->sock = (int)handle; +#else hd->sock = dup (hd->sock); +#endif if (hd->sock == -1) return gpg_error_from_syserror (); } @@ -1490,7 +1499,7 @@ start_server () } #endif -/* Actually connect to a server. Returns the file descripto or -1 on +/* Actually connect to a server. Returns the file descriptor or -1 on error. ERRNO is set on error. */ static int connect_server (const char *server, unsigned short port, @@ -1765,7 +1774,12 @@ cookie_read (void *cookie, void *buffer, size_t size) { do { +#ifdef HAVE_W32_SYSTEM + /* Under Windows we need to use recv for a socket. */ + nread = recv (c->fd, buffer, size, 0); +#else nread = read (c->fd, buffer, size); +#endif } while (nread == -1 && errno == EINTR); } diff --git a/common/i18n.c b/common/i18n.c index 7ed4bb4de..7db8e20c5 100644 --- a/common/i18n.c +++ b/common/i18n.c @@ -52,7 +52,7 @@ i18n_switchto_utf8 (void) { #ifdef USE_SIMPLE_GETTEXT gettext_select_utf8 (1); -#elif define(ENABLE_NLS) +#elif defined(ENABLE_NLS) char *orig_codeset = bind_textdomain_codeset (PACKAGE_GT, NULL); # ifdef HAVE_LANGINFO_CODESET if (!orig_codeset) |