Index: openssl/apps/s_socket.c |
=================================================================== |
--- openssl/apps/s_socket.c (revision 105093) |
+++ openssl/apps/s_socket.c (working copy) |
@@ -237,13 +237,11 @@ |
int init_client(int *sock, char *host, int port, int type) |
{ |
unsigned char ip[4]; |
- short p=0; |
if (!host_ip(host,&(ip[0]))) |
{ |
return(0); |
} |
- if (p != 0) port=p; |
return(init_client_ip(sock,ip,port,type)); |
} |
@@ -272,7 +270,7 @@ |
if (s == INVALID_SOCKET) { perror("socket"); return(0); } |
-#ifndef OPENSSL_SYS_MPE |
+#if defined(SO_KEEPALIVE) && !defined(OPENSSL_SYS_MPE) |
if (type == SOCK_STREAM) |
{ |
i=0; |
@@ -282,7 +280,7 @@ |
#endif |
if (connect(s,(struct sockaddr *)&them,sizeof(them)) == -1) |
- { close(s); perror("connect"); return(0); } |
+ { closesocket(s); perror("connect"); return(0); } |
*sock=s; |
return(1); |
} |
@@ -291,7 +289,7 @@ |
{ |
int sock; |
char *name = NULL; |
- int accept_socket; |
+ int accept_socket = 0; |
int i; |
if (!init_server(&accept_socket,port,type)) return(0); |
@@ -329,7 +327,7 @@ |
{ |
int ret=0; |
struct sockaddr_in server; |
- int s= -1,i; |
+ int s= -1; |
if (!ssl_sock_init()) return(0); |
@@ -368,7 +366,6 @@ |
} |
/* Make it 128 for linux */ |
if (type==SOCK_STREAM && listen(s,128) == -1) goto err; |
- i=0; |
*sock=s; |
ret=1; |
err: |
@@ -386,7 +383,7 @@ |
static int do_accept(int acc_sock, int *sock, char **host) |
{ |
- int ret,i; |
+ int ret; |
struct hostent *h1,*h2; |
static struct sockaddr_in from; |
int len; |
@@ -409,6 +406,7 @@ |
if (ret == INVALID_SOCKET) |
{ |
#if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)) |
+ int i; |
i=WSAGetLastError(); |
BIO_printf(bio_err,"accept error %d\n",i); |
#else |
@@ -463,7 +461,6 @@ |
BIO_printf(bio_err,"gethostbyname failure\n"); |
return(0); |
} |
- i=0; |
if (h2->h_addrtype != AF_INET) |
{ |
BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n"); |