From 1615f2e1babca21d2b1ac66b2778d3bbcd9f47c9 Mon Sep 17 00:00:00 2001 From: Hein Wessels Date: Mon, 24 Apr 2023 16:11:41 +0200 Subject: [PATCH] net: ip: only define socklen_t if not already defined There is a chance that a previous declaration exists of socklen_t through the unistd.h header. Luckily that header defines a macro when it defines the type. This commit therefore uses that define to know if the type has already been declared or not, similar to what unistd.h does. Closes #57195 Signed-off-by: Hein Wessels --- include/zephyr/net/net_ip.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/zephyr/net/net_ip.h b/include/zephyr/net/net_ip.h index 4be1ea72c6f27..6c78428c1c7b5 100644 --- a/include/zephyr/net/net_ip.h +++ b/include/zephyr/net/net_ip.h @@ -164,7 +164,10 @@ struct in_addr { typedef unsigned short int sa_family_t; /** Length of a socket address */ +#ifndef __socklen_t_defined typedef size_t socklen_t; +#define __socklen_t_defined +#endif /* * Note that the sin_port and sin6_port are in network byte order