From a1d1d5a6d24748883cfe6bb7018681bc3af00f87 Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Mon, 22 Jul 2024 15:13:22 +0800
Subject: [PATCH] POSIX: fix select timeout disable and build failed in
 openEuler 2003

---
 src/lstack/api/lstack_wrap.c     | 3 ++-
 src/lstack/core/lstack_preload.c | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lstack/api/lstack_wrap.c b/src/lstack/api/lstack_wrap.c
index 976a3f3..397870e 100644
--- a/src/lstack/api/lstack_wrap.c
+++ b/src/lstack/api/lstack_wrap.c
@@ -636,8 +636,9 @@ static int32_t do_sigaction(int32_t signum, const struct sigaction *act, struct
 
 static int32_t do_select(int32_t nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
 {
+    /* while input args are invalid, param timeout will steal be executed in kernel */
     if (nfds <= 0 || !(readfds || writefds || exceptfds)) {
-        GAZELLE_RETURN(EINVAL);
+        return posix_api->select_fn(nfds, readfds, writefds, exceptfds, timeout);
     }
 
     if (select_posix_path() == POSIX_KERNEL) {
diff --git a/src/lstack/core/lstack_preload.c b/src/lstack/core/lstack_preload.c
index 689d2bf..0a1df7d 100644
--- a/src/lstack/core/lstack_preload.c
+++ b/src/lstack/core/lstack_preload.c
@@ -14,6 +14,7 @@
 #include <unistd.h>
 #include <pthread.h>
 #include <securec.h>
+#include <stdbool.h>
 
 #include <lwip/lwipgz_posix_api.h>
 #include <lwip/lwipgz_sock.h>
-- 
2.33.0

