[prev in list] [next in list] [prev in thread] [next in thread] 

List:       musl
Subject:    [musl] [PATCH v2] dirent: fix signature for getdents64
From:       Jiaqing Zhao <jiaqing.zhao () linux ! intel ! com>
Date:       2022-05-28 12:37:17
Message-ID: 20220528123716.1403333-1-jiaqing.zhao () linux ! intel ! com
[Download RAW message or body]

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@linux.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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic