From 12712db2aa9fe11e6b374486acdbf730a05fb0d0 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Wed, 18 Sep 2024 15:54:30 -0700 Subject: [PATCH] doc and lint --- include/aws/io/socket.h | 4 ++-- source/posix/socket.c | 6 +----- tests/socket_test.c | 12 ++++++------ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/include/aws/io/socket.h b/include/aws/io/socket.h index 6d4e67fde..708aaf067 100644 --- a/include/aws/io/socket.h +++ b/include/aws/io/socket.h @@ -338,8 +338,8 @@ AWS_IO_API int aws_socket_validate_port_for_bind(uint32_t port, enum aws_socket_ AWS_IO_API void aws_socket_endpoint_init_local_address_for_test(struct aws_socket_endpoint *endpoint); /** - * Assigns a random address (UUID) for use with AWS_SOCKET_LOCAL (Unix Domain Sockets). - * For use in internal tests only. + * Validates whether the network interface name is valid. On Windows, it will always return false since network + * interface names are not supported on Windows */ AWS_IO_API bool aws_is_network_interface_name_valid(char *interface_name); diff --git a/source/posix/socket.c b/source/posix/socket.c index ac6974678..9e185909d 100644 --- a/source/posix/socket.c +++ b/source/posix/socket.c @@ -2010,11 +2010,7 @@ void aws_socket_endpoint_init_local_address_for_test(struct aws_socket_endpoint bool aws_is_network_interface_name_valid(char *interface_name) { if (if_nametoindex(interface_name) == 0) { - AWS_LOGF_ERROR( - AWS_LS_IO_SOCKET, - "network_interface_name(%s) is invalid with errno: %d", - interface_name, - errno); + AWS_LOGF_ERROR(AWS_LS_IO_SOCKET, "network_interface_name(%s) is invalid with errno: %d", interface_name, errno); return false; } return true; diff --git a/tests/socket_test.c b/tests/socket_test.c index fda39f0c4..d0543c6c0 100644 --- a/tests/socket_test.c +++ b/tests/socket_test.c @@ -498,14 +498,14 @@ AWS_TEST_CASE(test_socket_with_bind_to_invalid_interface, s_test_socket_with_bin static int s_test_is_network_interface_name_valid(struct aws_allocator *allocator, void *ctx) { (void)ctx; - (void) allocator; + (void)allocator; ASSERT_FALSE(aws_is_network_interface_name_valid("invalid_name")); - #if defined(AWS_OS_APPLE) - ASSERT_TRUE(aws_is_network_interface_name_valid("lo0")); - #elif !defined(AWS_OS_WINDOWS) - ASSERT_TRUE(aws_is_network_interface_name_valid("lo")); - #endif +#if defined(AWS_OS_APPLE) + ASSERT_TRUE(aws_is_network_interface_name_valid("lo0")); +#elif !defined(AWS_OS_WINDOWS) + ASSERT_TRUE(aws_is_network_interface_name_valid("lo")); +#endif return AWS_OP_SUCCESS; } AWS_TEST_CASE(test_is_network_interface_name_valid, s_test_is_network_interface_name_valid)