From 27dbeef72e8eec6aa834db7daad4cc23dd7b027e Mon Sep 17 00:00:00 2001 From: Nathan Moinvaziri Date: Tue, 1 Aug 2023 11:23:12 -0700 Subject: [PATCH] Use const correctness after resolving casting warnings. --- wpad_dhcp_posix.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wpad_dhcp_posix.c b/wpad_dhcp_posix.c index cca3f6f..8139a20 100644 --- a/wpad_dhcp_posix.c +++ b/wpad_dhcp_posix.c @@ -169,13 +169,14 @@ static bool dhcp_send_inform(SOCKET sfd, uint32_t xid, net_adapter_s *adapter) { opts = dhcp_copy_option(opts, &opt_end); // Broadcast DHCP request - ssize_t request_len = (ssize_t)(opts - (uint8_t *)&request); - ssize_t sent = sendto(sfd, (const char *)&request, request_len, 0, (struct sockaddr *)&address, sizeof(address)); + const ssize_t request_len = (ssize_t)(opts - (uint8_t *)&request); + const ssize_t sent = + sendto(sfd, (const char *)&request, request_len, 0, (struct sockaddr *)&address, sizeof(address)); return sent == request_len; } static bool dhcp_read_reply(SOCKET sfd, uint32_t request_xid, dhcp_msg *reply) { - ssize_t response_len = recvfrom(sfd, (char *)reply, sizeof(dhcp_msg), 0, NULL, NULL); + const ssize_t response_len = recvfrom(sfd, (char *)reply, sizeof(dhcp_msg), 0, NULL, NULL); if (response_len <= (ssize_t)(sizeof(dhcp_msg) - DHCP_OPT_MIN_LENGTH)) { LOG_DEBUG("Unable to read DHCP reply (%d:%d)\n", response_len, socketerr);