diff options
author | Andy Polyakov <appro@openssl.org> | 2015-09-30 10:15:03 +0200 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2015-10-05 09:22:54 +0200 |
commit | b13fdc4860b5e1bf615b113950788a138e68ae7f (patch) | |
tree | 231723cef2d8432fa559e011d5c7eed93a2482c5 /apps/s_socket.c | |
parent | Free up ASN.1 structures at top level only. (diff) | |
download | openssl-b13fdc4860b5e1bf615b113950788a138e68ae7f.tar.xz openssl-b13fdc4860b5e1bf615b113950788a138e68ae7f.zip |
Explicitly cast INVALID_SOCKET to (int) to address warnings on Windows.
Even though SOCKET is effectively declared as (void *) on Windows, it's
not actually a pointer, but an index within per-process table of
kernel objects. The table size is actually limited and its upper limit
is far below upper limit for signed 32-bit integer. This is what makes
cast in question possible.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'apps/s_socket.c')
-rw-r--r-- | apps/s_socket.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/s_socket.c b/apps/s_socket.c index c1faffc494..9d1f04a6c5 100644 --- a/apps/s_socket.c +++ b/apps/s_socket.c @@ -266,7 +266,7 @@ static int init_client_ip(int *sock, const unsigned char ip[4], int port, else /* ( type == SOCK_DGRAM) */ s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (s == INVALID_SOCKET) { + if (s == (int)INVALID_SOCKET) { perror("socket"); return (0); } @@ -303,7 +303,7 @@ int init_client_unix(int *sock, const char *server) return (0); s = socket(AF_UNIX, SOCK_STREAM, 0); - if (s == INVALID_SOCKET) { + if (s == (int)INVALID_SOCKET) { perror("socket"); return (0); } @@ -428,7 +428,7 @@ static int init_server_long(int *sock, int port, char *ip, int type) else /* type == SOCK_DGRAM */ s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (s == INVALID_SOCKET) + if (s == (int)INVALID_SOCKET) goto err; # if defined SOL_SOCKET && defined SO_REUSEADDR { @@ -472,7 +472,7 @@ static int init_server_unix(int *sock, const char *path) return (0); s = socket(AF_UNIX, SOCK_STREAM, 0); - if (s == INVALID_SOCKET) + if (s == (int)INVALID_SOCKET) goto err; memset(&server, 0, sizeof(server)); @@ -527,7 +527,7 @@ static int do_accept(int acc_sock, int *sock, char **host) * can either go for (int *) or (void *). */ ret = accept(acc_sock, (struct sockaddr *)&from, (void *)&len); - if (ret == INVALID_SOCKET) { + if (ret == (int)INVALID_SOCKET) { # if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)) int i; i = WSAGetLastError(); @@ -589,7 +589,7 @@ static int do_accept_unix(int acc_sock, int *sock) redoit: ret = accept(acc_sock, NULL, NULL); - if (ret == INVALID_SOCKET) { + if (ret == (int)INVALID_SOCKET) { if (errno == EINTR) { /* * check_timeout(); |