Kouhei Sutou
null+****@clear*****
Wed Aug 1 16:15:25 JST 2018
Kouhei Sutou 2018-08-01 16:15:25 +0900 (Wed, 01 Aug 2018) New Revision: 620b53a203d11b6602ab1f11d1a3321ce0f0c443 https://github.com/groonga/groonga/commit/620b53a203d11b6602ab1f11d1a3321ce0f0c443 Message: windows: use INVALID_SOCKET for check connect()'s return value Windows connect() doesn't use -1 for invalid socket. Modified files: lib/com.c lib/grn.h Modified: lib/com.c (+2 -1) =================================================================== --- lib/com.c 2018-08-01 16:11:48 +0900 (96905ec7f) +++ lib/com.c 2018-08-01 16:15:25 +0900 (685e724af) @@ -1,6 +1,7 @@ /* -*- c-basic-offset: 2 -*- */ /* Copyright(C) 2009-2018 Brazil + Copyright(C) 2018 Kouhei Sutou <kou �� clear-code.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -982,7 +983,7 @@ grn_com_copen(grn_ctx *ctx, grn_com_event *ev, const char *dest, int port) addrinfo_ptr = addrinfo_ptr->ai_next) { fd = socket(addrinfo_ptr->ai_family, addrinfo_ptr->ai_socktype, addrinfo_ptr->ai_protocol); - if (fd == -1) { + if (fd == GRN_INVALID_SOCKET) { SOERR("socket"); continue; } Modified: lib/grn.h (+7 -0) =================================================================== --- lib/grn.h 2018-08-01 16:11:48 +0900 (f95f940fa) +++ lib/grn.h 2018-08-01 16:15:25 +0900 (5cf6ab953) @@ -1,6 +1,7 @@ /* -*- c-basic-offset: 2 -*- */ /* Copyright(C) 2009-2018 Brazil + Copyright(C) 2018 Kouhei Sutou <kou �� clear-code.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -676,6 +677,12 @@ grn_str_greater(const uint8_t *ap, uint32_t as, const uint8_t *bp, uint32_t bs) #define GRN_NEXT_ADDR(p) (((byte *)(p)) + sizeof(*(p))) +#ifdef WIN32 +# define GRN_INVALID_SOCKET INVALID_SOCKET +#else /* WIN32 */ +# define GRN_INVALID_SOCKET -1 +#endif /* WIN32 */ + GRN_API void grn_sleep(uint32_t seconds); GRN_API void grn_nanosleep(uint64_t nanoseconds); -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180801/6d6bc8d7/attachment-0001.htm