diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | lib/sockets.c | 7 | ||||
-rw-r--r-- | lib/sockets.h | 10 |
3 files changed, 20 insertions, 7 deletions
@@ -1,3 +1,13 @@ +2015-09-25 Paul Eggert <eggert@cs.ucla.edu> + + sockets: MS Windows initalization fixes + Problem reported by Test User in: + http://lists.gnu.org/archive/html/help-shishi/2015-09/msg00001.html + * lib/sockets.h (SOCKETS_1_0, SOCKETS_2_0, SOCKETS_2_1): + Correct the endianness. + * lib/sockets.c (gl_sockets_startup): Return 2 on any version + number mismatch, not just on <. Cleanup before any such failure. + 2015-09-25 Mats Erik Andersson <gnu@gisladisker.se> gc: fix detection of installed libgcrypt version diff --git a/lib/sockets.c b/lib/sockets.c index 0b60562c4c..e644ff12c9 100644 --- a/lib/sockets.c +++ b/lib/sockets.c @@ -121,8 +121,11 @@ gl_sockets_startup (int version _GL_UNUSED) if (err != 0) return 1; - if (data.wVersion < version) - return 2; + if (data.wVersion != version) + { + WSACleanup (); + return 2; + } if (initialized_sockets_version == 0) register_fd_hook (close_fd_maybe_socket, ioctl_fd_maybe_socket, diff --git a/lib/sockets.h b/lib/sockets.h index c863dfbef4..173d032443 100644 --- a/lib/sockets.h +++ b/lib/sockets.h @@ -20,11 +20,11 @@ #ifndef SOCKETS_H # define SOCKETS_H 1 -#define SOCKETS_1_0 0x100 /* don't use - does not work on Windows XP */ -#define SOCKETS_1_1 0x101 -#define SOCKETS_2_0 0x200 /* don't use - does not work on Windows XP */ -#define SOCKETS_2_1 0x201 -#define SOCKETS_2_2 0x202 +#define SOCKETS_1_0 0x0001 +#define SOCKETS_1_1 0x0101 +#define SOCKETS_2_0 0x0002 +#define SOCKETS_2_1 0x0102 +#define SOCKETS_2_2 0x0202 int gl_sockets_startup (int version) #if !WINDOWS_SOCKETS |