]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
stat-util: do not use RET_NERRNO for our own function
authorMike Yuan <me@yhndnzj.com>
Mon, 19 Jan 2026 00:13:01 +0000 (01:13 +0100)
committerMike Yuan <me@yhndnzj.com>
Mon, 19 Jan 2026 12:33:27 +0000 (13:33 +0100)
Follow-up for 95abe4beff08636681069623ffdf16cfa34c7cf8

src/basic/stat-util.c

index d1c5d7aa37b7310dec06728a093c5d6f243bdd64..5113d0459bae7b81003528fe56231b8b26921b2a 100644 (file)
@@ -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 });
 }