1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-30 10:50:15 +03:00

dirent-util: add several assertions in posix_getdents()

Follow-up for e86a492ff08526e5adf85fa881c76f80adc3c84a.
This commit is contained in:
Yu Watanabe 2025-03-05 00:05:31 +09:00 committed by Lennart Poettering
parent cf62e00295
commit c4eef17990

View File

@ -34,6 +34,13 @@ struct dirent *readdir_no_dot(DIR *dirp);
* Let's introduce a simple wrapper. */
#if !HAVE_POSIX_GETDENTS
static inline ssize_t posix_getdents(int fd, void *buf, size_t nbyte, int flags) {
assert(fd >= 0);
assert(buf);
assert(nbyte > 0);
if (flags != 0)
return -EINVAL; /* Currently flags must be zero. */
return getdents64(fd, buf, nbyte);
}
#endif