Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Date: Sat, 28 May 2022 20:37:17 +0800
From: Jiaqing Zhao <jiaqing.zhao@...ux.intel.com>
To: musl@...ts.openwall.com
Cc: Jiaqing Zhao <jiaqing.zhao@...ux.intel.com>
Subject: [PATCH v2] dirent: fix signature for getdents64

Currently musl's getdents64 is an alias for getdents, but the API is
different. According to man page[1], the 2nd arguments of getdents64
is void* instead of struct dirent*.
    ssize_t getdents64(int fd, void *dirp, size_t count);
This patch adds type cast to the redirect macro for API compatibility.

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@...ux.intel.com>
---
 include/dirent.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/dirent.h b/include/dirent.h
index 650ecf64..0ac1ce60 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -65,7 +65,7 @@ int versionsort(const struct dirent **, const struct dirent **);
 #define versionsort64 versionsort
 #define off64_t off_t
 #define ino64_t ino_t
-#define getdents64 getdents
+#define getdents64(fd, buf, len) getdents((fd), (struct dirent *)(buf), (len))
 #endif
 
 #ifdef __cplusplus
-- 
2.34.1

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.