-/* crypto/bio/bss_acpt.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include <stdio.h>
#include <errno.h>
#define USE_SOCKETS
-#include "cryptlib.h"
+#include "internal/cryptlib.h"
#include <openssl/bio.h>
#ifndef OPENSSL_NO_SOCK
+/*
+ * We are currently using deprecated functions here, and GCC warns
+ * us about them, but since we know, we don't want to hear it.
+ */
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
# if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
# undef FIONBIO
BIO_ACCEPT *ba;
bi->init = 0;
- bi->num = INVALID_SOCKET;
+ bi->num = (int)INVALID_SOCKET;
bi->flags = 0;
if ((ba = BIO_ACCEPT_new()) == NULL)
return (0);
{
BIO_ACCEPT *ret;
- if ((ret = (BIO_ACCEPT *)OPENSSL_malloc(sizeof(BIO_ACCEPT))) == NULL)
+ if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
return (NULL);
-
- memset(ret, 0, sizeof(BIO_ACCEPT));
- ret->accept_sock = INVALID_SOCKET;
+ ret->accept_sock = (int)INVALID_SOCKET;
ret->bind_mode = BIO_BIND_NORMAL;
return (ret);
}
if (a == NULL)
return;
- if (a->param_addr != NULL)
- OPENSSL_free(a->param_addr);
- if (a->addr != NULL)
- OPENSSL_free(a->addr);
- if (a->bio_chain != NULL)
- BIO_free(a->bio_chain);
+ OPENSSL_free(a->param_addr);
+ OPENSSL_free(a->addr);
+ BIO_free(a->bio_chain);
OPENSSL_free(a);
}
BIO_ACCEPT *c;
c = (BIO_ACCEPT *)bio->ptr;
- if (c->accept_sock != INVALID_SOCKET) {
+ if (c->accept_sock != (int)INVALID_SOCKET) {
shutdown(c->accept_sock, 2);
closesocket(c->accept_sock);
- c->accept_sock = INVALID_SOCKET;
- bio->num = INVALID_SOCKET;
+ c->accept_sock = (int)INVALID_SOCKET;
+ bio->num = (int)INVALID_SOCKET;
}
}
return (-1);
}
s = BIO_get_accept_socket(c->param_addr, c->bind_mode);
- if (s == INVALID_SOCKET)
+ if (s == (int)INVALID_SOCKET)
return (-1);
if (c->accept_nbio) {
if (ptr != NULL) {
if (num == 0) {
b->init = 1;
- if (data->param_addr != NULL)
- OPENSSL_free(data->param_addr);
- data->param_addr = BUF_strdup(ptr);
+ OPENSSL_free(data->param_addr);
+ data->param_addr = OPENSSL_strdup(ptr);
} else if (num == 1) {
data->accept_nbio = (ptr != NULL);
} else if (num == 2) {
- if (data->bio_chain != NULL)
- BIO_free(data->bio_chain);
+ BIO_free(data->bio_chain);
data->bio_chain = (BIO *)ptr;
}
}
return (NULL);
if (BIO_set_accept_port(ret, str))
return (ret);
- else {
- BIO_free(ret);
- return (NULL);
- }
+ BIO_free(ret);
+ return (NULL);
}
#endif