mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
dirent-util: add several assertions in posix_getdents()
Follow-up for e86a492ff0.
This commit is contained in:
committed by
Lennart Poettering
parent
cf62e00295
commit
c4eef17990
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user