From e5a1b00f15b070b93d1820af72b838d4d3a4b034 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 10 Apr 2023 17:22:48 +0200 Subject: init: fix build with glibc 2.30 and above Newer versions of glibc finally define the getdents64(), but still not the structure linux_dirent64 that is needed to go with it. And the definition collides with ours (it uses a void*). Let's add a guard. This was tested both with 2.28 and 2.31. --- init/init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init/init.c b/init/init.c index 14ebc1a..e08f70f 100644 --- a/init/init.c +++ b/init/init.c @@ -116,10 +116,12 @@ struct linux_dirent64 { char d_name[]; }; -static int getdents64(int fd, struct linux_dirent64 *dirp, unsigned int count) +#if (!defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 30)) +static long getdents64(int fd, struct linux_dirent64 *dirp, unsigned long count) { return syscall(SYS_getdents64, fd, dirp, count); } +#endif int pivot_root(const char *new_root, const char *put_old); #endif -- 2.35.3