mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
To: musl@lists.openwall.com
Cc: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
Subject: [musl] [PATCH v2] dirent: fix signature for getdents64
Date: Sat, 28 May 2022 20:37:17 +0800	[thread overview]
Message-ID: <20220528123716.1403333-1-jiaqing.zhao@linux.intel.com> (raw)

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


                 reply	other threads:[~2022-05-28 12:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220528123716.1403333-1-jiaqing.zhao@linux.intel.com \
    --to=jiaqing.zhao@linux.intel.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).