aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2023-02-08 07:42:39 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2023-02-08 07:42:39 +0300
commit3b51ba21855488020df8a45b52e443ef24215ec4 (patch)
tree3d1a584d74cce9d63e426dceb26a05ff0a8fc222 /contrib/restricted
parenta6db175bc7b561a844f55c2916c329086e52b866 (diff)
downloadydb-3b51ba21855488020df8a45b52e443ef24215ec4.tar.gz
Update contrib/restricted/aws/aws-c-io to 0.13.14
Diffstat (limited to 'contrib/restricted')
-rw-r--r--contrib/restricted/aws/aws-c-io/source/channel.c2
-rw-r--r--contrib/restricted/aws/aws-c-io/source/channel_bootstrap.c4
-rw-r--r--contrib/restricted/aws/aws-c-io/source/exponential_backoff_retry_strategy.c8
-rw-r--r--contrib/restricted/aws/aws-c-io/source/host_resolver.c2
-rw-r--r--contrib/restricted/aws/aws-c-io/source/linux/epoll_event_loop.c2
-rw-r--r--contrib/restricted/aws/aws-c-io/source/posix/pipe.c12
-rw-r--r--contrib/restricted/aws/aws-c-io/source/posix/socket.c109
-rw-r--r--contrib/restricted/aws/aws-c-io/source/s2n/s2n_tls_channel_handler.c6
-rw-r--r--contrib/restricted/aws/aws-c-io/source/stream.c1
-rw-r--r--contrib/restricted/aws/aws-c-io/source/tls_channel_handler.c4
10 files changed, 85 insertions, 65 deletions
diff --git a/contrib/restricted/aws/aws-c-io/source/channel.c b/contrib/restricted/aws/aws-c-io/source/channel.c
index 47beb94c9b..8f85a7b9c8 100644
--- a/contrib/restricted/aws/aws-c-io/source/channel.c
+++ b/contrib/restricted/aws/aws-c-io/source/channel.c
@@ -162,7 +162,7 @@ static void s_on_channel_setup_complete(struct aws_task *task, void *arg, enum a
AWS_LS_IO_CHANNEL,
"id=%p: message pool %p found in event-loop local storage: using it.",
(void *)setup_args->channel,
- (void *)message_pool)
+ (void *)message_pool);
}
setup_args->channel->msg_pool = message_pool;
diff --git a/contrib/restricted/aws/aws-c-io/source/channel_bootstrap.c b/contrib/restricted/aws/aws-c-io/source/channel_bootstrap.c
index b43f6591d7..0f92399b90 100644
--- a/contrib/restricted/aws/aws-c-io/source/channel_bootstrap.c
+++ b/contrib/restricted/aws/aws-c-io/source/channel_bootstrap.c
@@ -1335,8 +1335,8 @@ struct aws_socket *aws_server_bootstrap_new_socket_listener(
const struct aws_server_socket_channel_bootstrap_options *bootstrap_options) {
AWS_PRECONDITION(bootstrap_options);
AWS_PRECONDITION(bootstrap_options->bootstrap);
- AWS_PRECONDITION(bootstrap_options->incoming_callback)
- AWS_PRECONDITION(bootstrap_options->shutdown_callback)
+ AWS_PRECONDITION(bootstrap_options->incoming_callback);
+ AWS_PRECONDITION(bootstrap_options->shutdown_callback);
struct server_connection_args *server_connection_args =
aws_mem_calloc(bootstrap_options->bootstrap->allocator, 1, sizeof(struct server_connection_args));
diff --git a/contrib/restricted/aws/aws-c-io/source/exponential_backoff_retry_strategy.c b/contrib/restricted/aws/aws-c-io/source/exponential_backoff_retry_strategy.c
index 22b53b2991..eee20360e7 100644
--- a/contrib/restricted/aws/aws-c-io/source/exponential_backoff_retry_strategy.c
+++ b/contrib/restricted/aws/aws-c-io/source/exponential_backoff_retry_strategy.c
@@ -266,7 +266,7 @@ static int s_exponential_retry_schedule_retry(
AWS_LS_IO_EXPONENTIAL_BACKOFF_RETRY_STRATEGY,
"id=%p: retry token %p is already scheduled.",
(void *)backoff_retry_token->base.retry_strategy,
- (void *)token)
+ (void *)token);
return aws_raise_error(AWS_ERROR_INVALID_STATE);
}
@@ -307,9 +307,9 @@ struct aws_retry_strategy *aws_retry_strategy_new_exponential_backoff(
struct aws_allocator *allocator,
const struct aws_exponential_backoff_retry_options *config) {
AWS_PRECONDITION(config);
- AWS_PRECONDITION(config->el_group)
- AWS_PRECONDITION(config->jitter_mode <= AWS_EXPONENTIAL_BACKOFF_JITTER_DECORRELATED)
- AWS_PRECONDITION(config->max_retries)
+ AWS_PRECONDITION(config->el_group);
+ AWS_PRECONDITION(config->jitter_mode <= AWS_EXPONENTIAL_BACKOFF_JITTER_DECORRELATED);
+ AWS_PRECONDITION(config->max_retries);
if (config->max_retries > 63 || !config->el_group ||
config->jitter_mode > AWS_EXPONENTIAL_BACKOFF_JITTER_DECORRELATED) {
diff --git a/contrib/restricted/aws/aws-c-io/source/host_resolver.c b/contrib/restricted/aws/aws-c-io/source/host_resolver.c
index 5e3b2633cf..050f00a187 100644
--- a/contrib/restricted/aws/aws-c-io/source/host_resolver.c
+++ b/contrib/restricted/aws/aws-c-io/source/host_resolver.c
@@ -1199,7 +1199,7 @@ static void aws_host_resolver_thread(void *arg) {
AWS_LS_IO_DNS,
"static: Either no requests have been made for an address for %s for the duration "
"of the ttl, or this thread is being forcibly shutdown. Killing thread.",
- host_entry->host_name->bytes)
+ host_entry->host_name->bytes);
done:
diff --git a/contrib/restricted/aws/aws-c-io/source/linux/epoll_event_loop.c b/contrib/restricted/aws/aws-c-io/source/linux/epoll_event_loop.c
index 151ffef9c1..af1ed765df 100644
--- a/contrib/restricted/aws/aws-c-io/source/linux/epoll_event_loop.c
+++ b/contrib/restricted/aws/aws-c-io/source/linux/epoll_event_loop.c
@@ -19,7 +19,7 @@
#include <limits.h>
#include <unistd.h>
-#if !defined(COMPAT_MODE) && defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 8
+#if !defined(COMPAT_MODE) && defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8) || __GLIBC__ > 2)
# define USE_EFD 1
#else
# define USE_EFD 0
diff --git a/contrib/restricted/aws/aws-c-io/source/posix/pipe.c b/contrib/restricted/aws/aws-c-io/source/posix/pipe.c
index 2b67d90ec4..f727b021c7 100644
--- a/contrib/restricted/aws/aws-c-io/source/posix/pipe.c
+++ b/contrib/restricted/aws/aws-c-io/source/posix/pipe.c
@@ -12,7 +12,7 @@
#endif
/* TODO: move this detection to CMAKE and a config header */
-#if !defined(COMPAT_MODE) && defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 9
+#if !defined(COMPAT_MODE) && defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9) || __GLIBC__ > 2)
# define HAVE_PIPE2 1
#else
# define HAVE_PIPE2 0
@@ -276,10 +276,11 @@ int aws_pipe_read(struct aws_pipe_read_end *read_end, struct aws_byte_buf *dst_b
ssize_t read_val = read(read_impl->handle.data.fd, dst_buffer->buffer + dst_buffer->len, num_bytes_to_read);
if (read_val < 0) {
- if (errno == EAGAIN || errno == EWOULDBLOCK) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
+ if (errno_value == EAGAIN || errno_value == EWOULDBLOCK) {
return aws_raise_error(AWS_IO_READ_WOULD_BLOCK);
}
- return s_raise_posix_error(errno);
+ return s_raise_posix_error(errno_value);
}
/* Success */
@@ -449,14 +450,15 @@ static void s_write_end_process_requests(struct aws_pipe_write_end *write_end) {
ssize_t write_val = write(write_impl->handle.data.fd, request->cursor.ptr, request->cursor.len);
if (write_val < 0) {
- if (errno == EAGAIN || errno == EWOULDBLOCK) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
+ if (errno_value == EAGAIN || errno_value == EWOULDBLOCK) {
/* The pipe is no longer writable. Bail out */
write_impl->is_writable = false;
return;
}
/* A non-recoverable error occurred during this write */
- completed_error_code = s_translate_posix_error(errno);
+ completed_error_code = s_translate_posix_error(errno_value);
} else {
aws_byte_cursor_advance(&request->cursor, write_val);
diff --git a/contrib/restricted/aws/aws-c-io/source/posix/socket.c b/contrib/restricted/aws/aws-c-io/source/posix/socket.c
index 240262ccfb..7adf970c77 100644
--- a/contrib/restricted/aws/aws-c-io/source/posix/socket.c
+++ b/contrib/restricted/aws/aws-c-io/source/posix/socket.c
@@ -139,6 +139,8 @@ static int s_determine_socket_error(int error) {
static int s_create_socket(struct aws_socket *sock, const struct aws_socket_options *options) {
int fd = socket(s_convert_domain(options->domain), s_convert_type(options->type), 0);
+ int errno_value = errno; /* Always cache errno before potential side-effect */
+
AWS_LOGF_DEBUG(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: initializing with domain %d and type %d",
@@ -156,7 +158,7 @@ static int s_create_socket(struct aws_socket *sock, const struct aws_socket_opti
return aws_socket_set_options(sock, options);
}
- int aws_error = s_determine_socket_error(errno);
+ int aws_error = s_determine_socket_error(errno_value);
return aws_raise_error(aws_error);
}
@@ -276,13 +278,14 @@ static int s_update_local_endpoint(struct aws_socket *socket) {
socklen_t address_size = sizeof(address);
if (getsockname(socket->io_handle.data.fd, (struct sockaddr *)&address, &address_size) != 0) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_ERROR(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: getsockname() failed with error %d",
(void *)socket,
socket->io_handle.data.fd,
- errno);
- int aws_error = s_determine_socket_error(errno);
+ errno_value);
+ int aws_error = s_determine_socket_error(errno_value);
return aws_raise_error(aws_error);
}
@@ -290,26 +293,29 @@ static int s_update_local_endpoint(struct aws_socket *socket) {
struct sockaddr_in *s = (struct sockaddr_in *)&address;
tmp_endpoint.port = ntohs(s->sin_port);
if (inet_ntop(AF_INET, &s->sin_addr, tmp_endpoint.address, sizeof(tmp_endpoint.address)) == NULL) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
+
AWS_LOGF_ERROR(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: inet_ntop() failed with error %d",
(void *)socket,
socket->io_handle.data.fd,
- errno);
- int aws_error = s_determine_socket_error(errno);
+ errno_value);
+ int aws_error = s_determine_socket_error(errno_value);
return aws_raise_error(aws_error);
}
} else if (address.ss_family == AF_INET6) {
struct sockaddr_in6 *s = (struct sockaddr_in6 *)&address;
tmp_endpoint.port = ntohs(s->sin6_port);
if (inet_ntop(AF_INET6, &s->sin6_addr, tmp_endpoint.address, sizeof(tmp_endpoint.address)) == NULL) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_ERROR(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: inet_ntop() failed with error %d",
(void *)socket,
socket->io_handle.data.fd,
- errno);
- int aws_error = s_determine_socket_error(errno);
+ errno_value);
+ int aws_error = s_determine_socket_error(errno_value);
return aws_raise_error(aws_error);
}
} else if (address.ss_family == AF_UNIX) {
@@ -376,13 +382,14 @@ static int s_on_connection_success(struct aws_socket *socket) {
socklen_t result_length = sizeof(connect_result);
if (getsockopt(socket->io_handle.data.fd, SOL_SOCKET, SO_ERROR, &connect_result, &result_length) < 0) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_ERROR(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: failed to determine connection error %d",
(void *)socket,
socket->io_handle.data.fd,
- errno);
- int aws_error = s_determine_socket_error(errno);
+ errno_value);
+ int aws_error = s_determine_socket_error(errno_value);
aws_raise_error(aws_error);
s_on_connection_error(socket, aws_error);
return AWS_OP_ERR;
@@ -549,12 +556,12 @@ static void s_run_connect_success(struct aws_task *task, void *arg, enum aws_tas
aws_mem_release(socket_args->allocator, socket_args);
}
-static inline int s_convert_pton_error(int pton_code) {
+static inline int s_convert_pton_error(int pton_code, int errno_value) {
if (pton_code == 0) {
return AWS_IO_SOCKET_INVALID_ADDRESS;
}
- return s_determine_socket_error(errno);
+ return s_determine_socket_error(errno_value);
}
struct socket_address {
@@ -665,6 +672,7 @@ int aws_socket_connect(
}
if (pton_err != 1) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_ERROR(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: failed to parse address %s:%d.",
@@ -672,7 +680,7 @@ int aws_socket_connect(
socket->io_handle.data.fd,
remote_endpoint->address,
(int)remote_endpoint->port);
- return aws_raise_error(s_convert_pton_error(pton_err));
+ return aws_raise_error(s_convert_pton_error(pton_err, errno_value));
}
AWS_LOGF_DEBUG(
@@ -717,8 +725,8 @@ int aws_socket_connect(
}
if (error_code) {
- error_code = errno;
- if (error_code == EINPROGRESS || error_code == EALREADY) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
+ if (errno_value == EINPROGRESS || errno_value == EALREADY) {
AWS_LOGF_TRACE(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: connection pending waiting on event-loop notification or timeout.",
@@ -766,8 +774,8 @@ int aws_socket_connect(
"id=%p fd=%d: connect failed with error code %d.",
(void *)socket,
socket->io_handle.data.fd,
- error_code);
- int aws_error = s_determine_socket_error(error_code);
+ errno_value);
+ int aws_error = s_determine_socket_error(errno_value);
aws_raise_error(aws_error);
socket->event_loop = NULL;
socket_impl->currently_subscribed = false;
@@ -836,6 +844,7 @@ int aws_socket_bind(struct aws_socket *socket, const struct aws_socket_endpoint
}
if (pton_err != 1) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_ERROR(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: failed to parse address %s:%d.",
@@ -843,18 +852,19 @@ int aws_socket_bind(struct aws_socket *socket, const struct aws_socket_endpoint
socket->io_handle.data.fd,
local_endpoint->address,
(int)local_endpoint->port);
- return aws_raise_error(s_convert_pton_error(pton_err));
+ return aws_raise_error(s_convert_pton_error(pton_err, errno_value));
}
if (bind(socket->io_handle.data.fd, (struct sockaddr *)&address.sock_addr_types, sock_size) != 0) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_ERROR(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: bind failed with error code %d",
(void *)socket,
socket->io_handle.data.fd,
- errno);
+ errno_value);
- aws_raise_error(s_determine_socket_error(errno));
+ aws_raise_error(s_determine_socket_error(errno_value));
goto error;
}
@@ -916,16 +926,18 @@ int aws_socket_listen(struct aws_socket *socket, int backlog_size) {
return AWS_OP_SUCCESS;
}
+ int errno_value = errno; /* Always cache errno before potential side-effect */
+
AWS_LOGF_ERROR(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: listen failed with error code %d",
(void *)socket,
socket->io_handle.data.fd,
- error_code);
- error_code = errno;
+ errno_value);
+
socket->state = ERROR;
- return aws_raise_error(s_determine_socket_error(error_code));
+ return aws_raise_error(s_determine_socket_error(errno_value));
}
/* this is called by the event loop handler that was installed in start_accept(). It runs once the FD goes readable,
@@ -952,9 +964,9 @@ static void s_socket_accept_event(
in_fd = accept(handle->data.fd, (struct sockaddr *)&in_addr, &in_len);
if (in_fd == -1) {
- int error = errno;
+ int errno_value = errno; /* Always cache errno before potential side-effect */
- if (error == EAGAIN || error == EWOULDBLOCK) {
+ if (errno_value == EAGAIN || errno_value == EWOULDBLOCK) {
break;
}
@@ -1000,7 +1012,7 @@ static void s_socket_accept_event(
AWS_LS_IO_SOCKET,
"id=%p fd=%d:. Failed to determine remote address.",
(void *)socket,
- socket->io_handle.data.fd)
+ socket->io_handle.data.fd);
}
new_sock->options.domain = AWS_SOCKET_IPV4;
} else if (in_addr.ss_family == AF_INET6) {
@@ -1017,7 +1029,7 @@ static void s_socket_accept_event(
AWS_LS_IO_SOCKET,
"id=%p fd=%d:. Failed to determine remote address.",
(void *)socket,
- socket->io_handle.data.fd)
+ socket->io_handle.data.fd);
}
new_sock->options.domain = AWS_SOCKET_IPV6;
} else if (in_addr.ss_family == AF_UNIX) {
@@ -1224,23 +1236,25 @@ int aws_socket_set_options(struct aws_socket *socket, const struct aws_socket_op
int option_value = 1;
if (AWS_UNLIKELY(setsockopt(
socket->io_handle.data.fd, SOL_SOCKET, NO_SIGNAL_SOCK_OPT, &option_value, sizeof(option_value)))) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_WARN(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: setsockopt() for NO_SIGNAL_SOCK_OPT failed with errno %d.",
(void *)socket,
socket->io_handle.data.fd,
- errno);
+ errno_value);
}
#endif /* NO_SIGNAL_SOCK_OPT */
int reuse = 1;
if (AWS_UNLIKELY(setsockopt(socket->io_handle.data.fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(int)))) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_WARN(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: setsockopt() for SO_REUSEADDR failed with errno %d.",
(void *)socket,
socket->io_handle.data.fd,
- errno);
+ errno_value);
}
if (options->type == AWS_SOCKET_STREAM && options->domain != AWS_SOCKET_LOCAL) {
@@ -1248,12 +1262,13 @@ int aws_socket_set_options(struct aws_socket *socket, const struct aws_socket_op
int keep_alive = 1;
if (AWS_UNLIKELY(
setsockopt(socket->io_handle.data.fd, SOL_SOCKET, SO_KEEPALIVE, &keep_alive, sizeof(int)))) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_WARN(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: setsockopt() for enabling SO_KEEPALIVE failed with errno %d.",
(void *)socket,
socket->io_handle.data.fd,
- errno);
+ errno_value);
}
}
@@ -1261,23 +1276,25 @@ int aws_socket_set_options(struct aws_socket *socket, const struct aws_socket_op
int ival_in_secs = socket->options.keep_alive_interval_sec;
if (AWS_UNLIKELY(setsockopt(
socket->io_handle.data.fd, IPPROTO_TCP, TCP_KEEPIDLE, &ival_in_secs, sizeof(ival_in_secs)))) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_WARN(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: setsockopt() for enabling TCP_KEEPIDLE for TCP failed with errno %d.",
(void *)socket,
socket->io_handle.data.fd,
- errno);
+ errno_value);
}
ival_in_secs = socket->options.keep_alive_timeout_sec;
if (AWS_UNLIKELY(setsockopt(
socket->io_handle.data.fd, IPPROTO_TCP, TCP_KEEPINTVL, &ival_in_secs, sizeof(ival_in_secs)))) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_WARN(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: setsockopt() for enabling TCP_KEEPINTVL for TCP failed with errno %d.",
(void *)socket,
socket->io_handle.data.fd,
- errno);
+ errno_value);
}
}
@@ -1285,12 +1302,13 @@ int aws_socket_set_options(struct aws_socket *socket, const struct aws_socket_op
int max_probes = socket->options.keep_alive_max_failed_probes;
if (AWS_UNLIKELY(
setsockopt(socket->io_handle.data.fd, IPPROTO_TCP, TCP_KEEPCNT, &max_probes, sizeof(max_probes)))) {
+ int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_WARN(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: setsockopt() for enabling TCP_KEEPCNT for TCP failed with errno %d.",
(void *)socket,
socket->io_handle.data.fd,
- errno);
+ errno_value);
}
}
}
@@ -1444,7 +1462,8 @@ int aws_socket_shutdown_dir(struct aws_socket *socket, enum aws_channel_directio
AWS_LOGF_DEBUG(
AWS_LS_IO_SOCKET, "id=%p fd=%d: shutting down in direction %d", (void *)socket, socket->io_handle.data.fd, dir);
if (shutdown(socket->io_handle.data.fd, how)) {
- int aws_error = s_determine_socket_error(errno);
+ int errno_value = errno; /* Always cache errno before potential side-effect */
+ int aws_error = s_determine_socket_error(errno_value);
return aws_raise_error(aws_error);
}
@@ -1539,6 +1558,7 @@ static int s_process_socket_write_requests(struct aws_socket *socket, struct soc
ssize_t written = send(
socket->io_handle.data.fd, write_request->cursor_cpy.ptr, write_request->cursor_cpy.len, NO_SIGNAL_SEND);
+ int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_TRACE(
AWS_LS_IO_SOCKET,
@@ -1548,14 +1568,13 @@ static int s_process_socket_write_requests(struct aws_socket *socket, struct soc
(int)written);
if (written < 0) {
- int error = errno;
- if (error == EAGAIN) {
+ if (errno_value == EAGAIN) {
AWS_LOGF_TRACE(
AWS_LS_IO_SOCKET, "id=%p fd=%d: returned would block", (void *)socket, socket->io_handle.data.fd);
break;
}
- if (error == EPIPE) {
+ if (errno_value == EPIPE) {
AWS_LOGF_DEBUG(
AWS_LS_IO_SOCKET,
"id=%p fd=%d: already closed before write",
@@ -1573,8 +1592,8 @@ static int s_process_socket_write_requests(struct aws_socket *socket, struct soc
"id=%p fd=%d: write error with error code %d",
(void *)socket,
socket->io_handle.data.fd,
- error);
- aws_error = s_determine_socket_error(error);
+ errno_value);
+ aws_error = s_determine_socket_error(errno_value);
aws_raise_error(aws_error);
break;
}
@@ -1780,7 +1799,7 @@ int aws_socket_read(struct aws_socket *socket, struct aws_byte_buf *buffer, size
}
ssize_t read_val = read(socket->io_handle.data.fd, buffer->buffer + buffer->len, buffer->capacity - buffer->len);
- int error = errno;
+ int errno_value = errno; /* Always cache errno before potential side-effect */
AWS_LOGF_TRACE(
AWS_LS_IO_SOCKET, "id=%p fd=%d: read of %d", (void *)socket, socket->io_handle.data.fd, (int)read_val);
@@ -1805,20 +1824,20 @@ int aws_socket_read(struct aws_socket *socket, struct aws_byte_buf *buffer, size
}
#if defined(EWOULDBLOCK)
- if (error == EAGAIN || error == EWOULDBLOCK) {
+ if (errno_value == EAGAIN || errno_value == EWOULDBLOCK) {
#else
- if (error == EAGAIN) {
+ if (errno_value == EAGAIN) {
#endif
AWS_LOGF_TRACE(AWS_LS_IO_SOCKET, "id=%p fd=%d: read would block", (void *)socket, socket->io_handle.data.fd);
return aws_raise_error(AWS_IO_READ_WOULD_BLOCK);
}
- if (error == EPIPE || error == ECONNRESET) {
+ if (errno_value == EPIPE || errno_value == ECONNRESET) {
AWS_LOGF_INFO(AWS_LS_IO_SOCKET, "id=%p fd=%d: socket is closed.", (void *)socket, socket->io_handle.data.fd);
return aws_raise_error(AWS_IO_SOCKET_CLOSED);
}
- if (error == ETIMEDOUT) {
+ if (errno_value == ETIMEDOUT) {
AWS_LOGF_ERROR(AWS_LS_IO_SOCKET, "id=%p fd=%d: socket timed out.", (void *)socket, socket->io_handle.data.fd);
return aws_raise_error(AWS_IO_SOCKET_TIMEOUT);
}
@@ -1828,8 +1847,8 @@ int aws_socket_read(struct aws_socket *socket, struct aws_byte_buf *buffer, size
"id=%p fd=%d: read failed with error: %s",
(void *)socket,
socket->io_handle.data.fd,
- strerror(error));
- return aws_raise_error(s_determine_socket_error(error));
+ strerror(errno_value));
+ return aws_raise_error(s_determine_socket_error(errno_value));
}
int aws_socket_write(
diff --git a/contrib/restricted/aws/aws-c-io/source/s2n/s2n_tls_channel_handler.c b/contrib/restricted/aws/aws-c-io/source/s2n/s2n_tls_channel_handler.c
index 32ed188a73..550c25f96b 100644
--- a/contrib/restricted/aws/aws-c-io/source/s2n/s2n_tls_channel_handler.c
+++ b/contrib/restricted/aws/aws-c-io/source/s2n/s2n_tls_channel_handler.c
@@ -467,7 +467,7 @@ static void s_negotiation_task(struct aws_channel_task *task, void *arg, aws_tas
int aws_tls_client_handler_start_negotiation(struct aws_channel_handler *handler) {
struct s2n_handler *s2n_handler = (struct s2n_handler *)handler->impl;
- AWS_LOGF_TRACE(AWS_LS_IO_TLS, "id=%p: Kicking off TLS negotiation.", (void *)handler)
+ AWS_LOGF_TRACE(AWS_LS_IO_TLS, "id=%p: Kicking off TLS negotiation.", (void *)handler);
if (aws_channel_thread_is_callers_thread(s2n_handler->slot->channel)) {
if (s2n_handler->state == NEGOTIATION_ONGOING) {
s_drive_negotiation(handler);
@@ -616,7 +616,7 @@ static void s_delayed_shutdown_task_fn(struct aws_channel_task *channel_task, vo
struct s2n_handler *s2n_handler = handler->impl;
if (status == AWS_TASK_STATUS_RUN_READY) {
- AWS_LOGF_DEBUG(AWS_LS_IO_TLS, "id=%p: Delayed shut down in write direction", (void *)handler)
+ AWS_LOGF_DEBUG(AWS_LS_IO_TLS, "id=%p: Delayed shut down in write direction", (void *)handler);
s2n_blocked_status blocked;
/* make a best effort, but the channel is going away after this run, so.... you only get one shot anyways */
s2n_shutdown(s2n_handler->connection, &blocked);
@@ -959,7 +959,7 @@ static int s_s2n_handler_shutdown(
if (dir == AWS_CHANNEL_DIR_WRITE) {
if (!abort_immediately && error_code != AWS_IO_SOCKET_CLOSED) {
- AWS_LOGF_DEBUG(AWS_LS_IO_TLS, "id=%p: Scheduling delayed write direction shutdown", (void *)handler)
+ AWS_LOGF_DEBUG(AWS_LS_IO_TLS, "id=%p: Scheduling delayed write direction shutdown", (void *)handler);
if (s_s2n_do_delayed_shutdown(handler, slot, error_code) == AWS_OP_SUCCESS) {
return AWS_OP_SUCCESS;
}
diff --git a/contrib/restricted/aws/aws-c-io/source/stream.c b/contrib/restricted/aws/aws-c-io/source/stream.c
index 4e49844e96..b8040946d2 100644
--- a/contrib/restricted/aws/aws-c-io/source/stream.c
+++ b/contrib/restricted/aws/aws-c-io/source/stream.c
@@ -289,7 +289,6 @@ struct aws_input_stream *aws_input_stream_new_from_file(struct aws_allocator *al
impl->file = aws_fopen(file_name, "r+b");
if (impl->file == NULL) {
- aws_translate_and_raise_io_error(errno);
goto on_error;
}
diff --git a/contrib/restricted/aws/aws-c-io/source/tls_channel_handler.c b/contrib/restricted/aws/aws-c-io/source/tls_channel_handler.c
index b667577456..aa80459b72 100644
--- a/contrib/restricted/aws/aws-c-io/source/tls_channel_handler.c
+++ b/contrib/restricted/aws/aws-c-io/source/tls_channel_handler.c
@@ -695,7 +695,7 @@ struct aws_channel_handler *aws_tls_server_handler_new(
struct aws_channel_slot *slot) {
AWS_FATAL_ASSERT(
s_client_handler_new &&
- "For BYO_CRYPTO, you must call aws_tls_server_handler_new_set_callback() with a non-null value.")
+ "For BYO_CRYPTO, you must call aws_tls_server_handler_new_set_callback() with a non-null value.");
return s_server_handler_new(allocator, options, slot, s_server_user_data);
}
@@ -720,7 +720,7 @@ void aws_tls_byo_crypto_set_server_setup_options(const struct aws_tls_byo_crypto
int aws_tls_client_handler_start_negotiation(struct aws_channel_handler *handler) {
AWS_FATAL_ASSERT(
s_start_negotiation_fn &&
- "For BYO_CRYPTO, you must call aws_tls_client_handler_set_start_negotiation_callback() with a non-null value.")
+ "For BYO_CRYPTO, you must call aws_tls_client_handler_set_start_negotiation_callback() with a non-null value.");
return s_start_negotiation_fn(handler, s_client_user_data);
}