Skip to content

Commit 0d8b1bc

Browse files
committed
Fix Zephyr build
1 parent 72be219 commit 0d8b1bc

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/wolfio.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@
2525
#endif
2626

2727
/* Enable GNU extensions for accept4() on Linux/glibc. Must be defined
28-
* before any system headers are included. */
29-
#if !defined(_WIN32) && !defined(_GNU_SOURCE)
28+
* before any system headers are included. Excluded for Zephyr and other
29+
* embedded RTOSes whose libc layers conflict with glibc-style definitions
30+
* (e.g., Zephyr's socket_select.h vs. glibc's fd_set). */
31+
#if (defined(__linux__) || defined(__ANDROID__)) && \
32+
!defined(__ZEPHYR__) && !defined(_GNU_SOURCE)
3033
#define _GNU_SOURCE 1
3134
#endif
3235

@@ -1630,8 +1633,8 @@ int wolfIO_TcpBind(SOCKET_T* sockfd, word16 port)
16301633
int wolfIO_TcpAccept(SOCKET_T sockfd, SOCKADDR* peer_addr, XSOCKLENT* peer_len)
16311634
{
16321635
int fd;
1633-
#if !defined(USE_WINDOWS_API) && defined(SOCK_CLOEXEC) && \
1634-
(defined(__linux__) || defined(__ANDROID__))
1636+
#if !defined(USE_WINDOWS_API) && !defined(__ZEPHYR__) && \
1637+
defined(SOCK_CLOEXEC) && (defined(__linux__) || defined(__ANDROID__))
16351638
fd = (int)accept4(sockfd, peer_addr, peer_len, SOCK_CLOEXEC);
16361639
#else
16371640
fd = (int)accept(sockfd, peer_addr, peer_len);

0 commit comments

Comments
 (0)