dirent-util: introduce simple wrapper of posix_getdents()
glibc exports getdents64 syscall as is, but musl exports it as posix_getdents(). Let's introduce a simple wrapper of posix_getdents(). Note, our baseline for glibc is 2.31. Hence, we can assume getdents64() always defined when building with glibc.
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
#include "macro.h"
|
||||
#include "missing_fs.h"
|
||||
#include "missing_magic.h"
|
||||
#include "missing_syscall.h"
|
||||
#include "mountpoint-util.h"
|
||||
#include "nulstr-util.h"
|
||||
#include "parse-util.h"
|
||||
@@ -172,7 +171,7 @@ int dir_is_empty_at(int dir_fd, const char *path, bool ignore_hidden_or_backup)
|
||||
struct dirent *de;
|
||||
ssize_t n;
|
||||
|
||||
n = getdents64(fd, buf, m);
|
||||
n = posix_getdents(fd, buf, m, /* flags = */ 0);
|
||||
if (n < 0)
|
||||
return -errno;
|
||||
if (n == 0)
|
||||
|
||||
Reference in New Issue
Block a user