diff options
Diffstat (limited to 'src/lib/libcrypto/bio/bss_conn.c')
-rw-r--r-- | src/lib/libcrypto/bio/bss_conn.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/libcrypto/bio/bss_conn.c b/src/lib/libcrypto/bio/bss_conn.c index c14727855b..bdf540030c 100644 --- a/src/lib/libcrypto/bio/bss_conn.c +++ b/src/lib/libcrypto/bio/bss_conn.c | |||
@@ -210,9 +210,9 @@ static int conn_state(BIO *b, BIO_CONNECT *c) | |||
210 | c->state=BIO_CONN_S_CREATE_SOCKET; | 210 | c->state=BIO_CONN_S_CREATE_SOCKET; |
211 | 211 | ||
212 | ret=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL); | 212 | ret=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL); |
213 | if (ret == INVALID_SOCKET) | 213 | if (ret == -1) |
214 | { | 214 | { |
215 | SYSerr(SYS_F_SOCKET,get_last_socket_error()); | 215 | SYSerr(SYS_F_SOCKET,errno); |
216 | ERR_add_error_data(4,"host=",c->param_hostname, | 216 | ERR_add_error_data(4,"host=",c->param_hostname, |
217 | ":",c->param_port); | 217 | ":",c->param_port); |
218 | BIOerr(BIO_F_CONN_STATE,BIO_R_UNABLE_TO_CREATE_SOCKET); | 218 | BIOerr(BIO_F_CONN_STATE,BIO_R_UNABLE_TO_CREATE_SOCKET); |
@@ -241,7 +241,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c) | |||
241 | i=setsockopt(b->num,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i)); | 241 | i=setsockopt(b->num,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i)); |
242 | if (i < 0) | 242 | if (i < 0) |
243 | { | 243 | { |
244 | SYSerr(SYS_F_SOCKET,get_last_socket_error()); | 244 | SYSerr(SYS_F_SOCKET,errno); |
245 | ERR_add_error_data(4,"host=",c->param_hostname, | 245 | ERR_add_error_data(4,"host=",c->param_hostname, |
246 | ":",c->param_port); | 246 | ":",c->param_port); |
247 | BIOerr(BIO_F_CONN_STATE,BIO_R_KEEPALIVE); | 247 | BIOerr(BIO_F_CONN_STATE,BIO_R_KEEPALIVE); |
@@ -266,7 +266,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c) | |||
266 | } | 266 | } |
267 | else | 267 | else |
268 | { | 268 | { |
269 | SYSerr(SYS_F_CONNECT,get_last_socket_error()); | 269 | SYSerr(SYS_F_CONNECT,errno); |
270 | ERR_add_error_data(4,"host=", | 270 | ERR_add_error_data(4,"host=", |
271 | c->param_hostname, | 271 | c->param_hostname, |
272 | ":",c->param_port); | 272 | ":",c->param_port); |
@@ -358,7 +358,7 @@ BIO_METHOD *BIO_s_connect(void) | |||
358 | static int conn_new(BIO *bi) | 358 | static int conn_new(BIO *bi) |
359 | { | 359 | { |
360 | bi->init=0; | 360 | bi->init=0; |
361 | bi->num=INVALID_SOCKET; | 361 | bi->num=-1; |
362 | bi->flags=0; | 362 | bi->flags=0; |
363 | if ((bi->ptr=(char *)BIO_CONNECT_new()) == NULL) | 363 | if ((bi->ptr=(char *)BIO_CONNECT_new()) == NULL) |
364 | return(0); | 364 | return(0); |
@@ -371,13 +371,13 @@ static void conn_close_socket(BIO *bio) | |||
371 | BIO_CONNECT *c; | 371 | BIO_CONNECT *c; |
372 | 372 | ||
373 | c=(BIO_CONNECT *)bio->ptr; | 373 | c=(BIO_CONNECT *)bio->ptr; |
374 | if (bio->num != INVALID_SOCKET) | 374 | if (bio->num != -1) |
375 | { | 375 | { |
376 | /* Only do a shutdown if things were established */ | 376 | /* Only do a shutdown if things were established */ |
377 | if (c->state == BIO_CONN_S_OK) | 377 | if (c->state == BIO_CONN_S_OK) |
378 | shutdown(bio->num,2); | 378 | shutdown(bio->num,2); |
379 | closesocket(bio->num); | 379 | close(bio->num); |
380 | bio->num=INVALID_SOCKET; | 380 | bio->num=-1; |
381 | } | 381 | } |
382 | } | 382 | } |
383 | 383 | ||
@@ -414,8 +414,8 @@ static int conn_read(BIO *b, char *out, int outl) | |||
414 | 414 | ||
415 | if (out != NULL) | 415 | if (out != NULL) |
416 | { | 416 | { |
417 | clear_socket_error(); | 417 | errno = 0; |
418 | ret=readsocket(b->num,out,outl); | 418 | ret=read(b->num,out,outl); |
419 | BIO_clear_retry_flags(b); | 419 | BIO_clear_retry_flags(b); |
420 | if (ret <= 0) | 420 | if (ret <= 0) |
421 | { | 421 | { |
@@ -438,8 +438,8 @@ static int conn_write(BIO *b, const char *in, int inl) | |||
438 | if (ret <= 0) return(ret); | 438 | if (ret <= 0) return(ret); |
439 | } | 439 | } |
440 | 440 | ||
441 | clear_socket_error(); | 441 | errno = 0; |
442 | ret=writesocket(b->num,in,inl); | 442 | ret=write(b->num,in,inl); |
443 | BIO_clear_retry_flags(b); | 443 | BIO_clear_retry_flags(b); |
444 | if (ret <= 0) | 444 | if (ret <= 0) |
445 | { | 445 | { |