From: Mike Yuan Date: Mon, 19 Jan 2026 00:13:01 +0000 (+0100) Subject: stat-util: do not use RET_NERRNO for our own function X-Git-Tag: v260-rc1~363^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b0906b12168dd82cd5ffca3913dcda7d75e58a53;p=thirdparty%2Fsystemd.git stat-util: do not use RET_NERRNO for our own function Follow-up for 95abe4beff08636681069623ffdf16cfa34c7cf8 --- diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c index d1c5d7aa37b..5113d0459ba 100644 --- a/src/basic/stat-util.c +++ b/src/basic/stat-util.c @@ -257,6 +257,22 @@ static int xfstatfs(int fd, struct statfs *ret) { return RET_NERRNO(fstatfs(fd, ret)); } +int xstatfsat(int dir_fd, const char *path, struct statfs *ret) { + _cleanup_close_ int fd = -EBADF; + + assert(dir_fd >= 0 || IN_SET(dir_fd, AT_FDCWD, XAT_FDROOT)); + assert(ret); + + if (!isempty(path)) { + fd = xopenat(dir_fd, path, O_PATH|O_CLOEXEC|O_NOCTTY); + if (fd < 0) + return fd; + dir_fd = fd; + } + + return xfstatfs(dir_fd, ret); +} + int fd_is_read_only_fs(int fd) { int r; @@ -522,22 +538,6 @@ bool statx_mount_same(const struct statx *a, const struct statx *b) { return a->stx_mnt_id == b->stx_mnt_id; } -int xstatfsat(int dir_fd, const char *path, struct statfs *ret) { - _cleanup_close_ int fd = -EBADF; - - assert(dir_fd >= 0 || IN_SET(dir_fd, AT_FDCWD, XAT_FDROOT)); - assert(ret); - - if (!isempty(path)) { - fd = xopenat(dir_fd, path, O_PATH|O_CLOEXEC|O_NOCTTY); - if (fd < 0) - return fd; - dir_fd = fd; - } - - return RET_NERRNO(xfstatfs(dir_fd, ret)); -} - usec_t statx_timestamp_load(const struct statx_timestamp *ts) { return timespec_load(&(const struct timespec) { .tv_sec = ts->tv_sec, .tv_nsec = ts->tv_nsec }); }