[LTP] [PATCH v1] getcwd01: Only check buffer NULL on glibc

Wei Gao wegao@suse.com
Thu Sep 28 03:08:08 CEST 2023


Signed-off-by: Wei Gao <wegao@suse.com>
---
 testcases/kernel/syscalls/getcwd/getcwd01.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/getcwd/getcwd01.c b/testcases/kernel/syscalls/getcwd/getcwd01.c
index 65d827873..6769eb6f4 100644
--- a/testcases/kernel/syscalls/getcwd/getcwd01.c
+++ b/testcases/kernel/syscalls/getcwd/getcwd01.c
@@ -34,10 +34,13 @@ static struct t_case {
 	int exp_err;
 } tcases[] = {
 	{(void *)-1, PATH_MAX, EFAULT},
-	{NULL, (size_t)-1, ENOMEM},
 	{buffer, 0, EINVAL},
 	{buffer, 1, ERANGE},
+/* musl and uclibc-ng will allocate memory before syscall if buf == NULL */
+#ifdef __GLIBC__
+	{NULL, (size_t)-1, ENOMEM},
 	{NULL, 1, ERANGE}
+#endif
 };
 
 static void verify_getcwd(unsigned int n)
-- 
2.35.3



More information about the ltp mailing list