fs-util: add access_fd() which is like access() but for fds

Linux doesn't have faccess(), hence let's emulate it. Linux has access()
and faccessat() but neither allows checking the access rights of an fd
passed in directly.
This commit is contained in:
Lennart Poettering
2017-11-17 11:12:33 +01:00
parent 994a6364d2
commit 57a4359ee0
3 changed files with 44 additions and 1 deletions
+2
View File
@@ -98,3 +98,5 @@ static inline void unlink_and_free(char *p) {
free(p);
}
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, unlink_and_free);
int access_fd(int fd, int mode);