From: Mike Yuan Date: Sun, 18 Jan 2026 22:02:19 +0000 (+0100) Subject: fs-util: drop fallback for kernels without AT_EMPTY_PATH support (< 5.8) X-Git-Tag: v260-rc1~363^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=52bf232e82d22a8c1443c40bfadcded2d65ea07a;p=thirdparty%2Fsystemd.git fs-util: drop fallback for kernels without AT_EMPTY_PATH support (< 5.8) --- diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index d3712622f17..4ca01c74440 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -321,22 +321,7 @@ int futimens_opath(int fd, const struct timespec ts[2]) { assert(fd >= 0); - if (utimensat(fd, "", ts, AT_EMPTY_PATH) >= 0) - return 0; - if (errno != EINVAL) - return -errno; - - /* Support for AT_EMPTY_PATH is added rather late (kernel 5.8), so fall back to going through /proc/ - * if unavailable. */ - - if (utimensat(AT_FDCWD, FORMAT_PROC_FD_PATH(fd), ts, /* flags= */ 0) < 0) { - if (errno != ENOENT) - return -errno; - - return proc_fd_enoent_errno(); - } - - return 0; + return RET_NERRNO(utimensat(fd, "", ts, AT_EMPTY_PATH)); } int stat_warn_permissions(const char *path, const struct stat *st) { @@ -722,22 +707,7 @@ int access_fd(int fd, int mode) { assert(fd >= 0); - if (faccessat(fd, "", mode, AT_EMPTY_PATH) >= 0) - return 0; - if (errno != EINVAL) - return -errno; - - /* Support for AT_EMPTY_PATH is added rather late (kernel 5.8), so fall back to going through /proc/ - * if unavailable. */ - - if (access(FORMAT_PROC_FD_PATH(fd), mode) < 0) { - if (errno != ENOENT) - return -errno; - - return proc_fd_enoent_errno(); - } - - return 0; + return RET_NERRNO(faccessat(fd, "", mode, AT_EMPTY_PATH)); } int unlinkat_deallocate(int fd, const char *name, UnlinkDeallocateFlags flags) {