linux: Fix compile warning using clang

This commit is contained in:
Roy Marples 2023-01-09 10:09:45 +00:00
parent fdcf878fff
commit 01b9b37dd8

View File

@ -1110,17 +1110,17 @@ ps_root_getifaddrs(struct dhcpcd_ctx *ctx, struct ifaddrs **ifahead)
len -= ALIGN(sizeof(*ifa)) + len -= ALIGN(sizeof(*ifa)) +
ALIGN(IFNAMSIZ) + ALIGN(sizeof(salen) * IFA_NADDRS); ALIGN(IFNAMSIZ) + ALIGN(sizeof(salen) * IFA_NADDRS);
#define COPYOUTSA(addr) \ #define COPYOUTSA(addr) \
do { \ do { \
memcpy(&salen, sap, sizeof(salen)); \ memcpy(&salen, sap, sizeof(salen)); \
if (len < salen) \ if (len < salen) \
goto err; \ goto err; \
if (salen != 0) { \ if (salen != 0) { \
(addr) = (struct sockaddr *)bp; \ (addr) = (struct sockaddr *)(void *)bp; \
bp += ALIGN(salen); \ bp += ALIGN(salen); \
len -= ALIGN(salen); \ len -= ALIGN(salen); \
} \ } \
sap += sizeof(salen); \ sap += sizeof(salen); \
} while (0 /* CONSTCOND */) } while (0 /* CONSTCOND */)
COPYOUTSA(ifa->ifa_addr); COPYOUTSA(ifa->ifa_addr);