summaryrefslogtreecommitdiffstats
path: root/stat.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2018-12-19 23:46:24 -0500
committerTavian Barnes <tavianator@tavianator.com>2018-12-19 23:46:24 -0500
commit5bec8030c77b735147cdf73359bc8f91b19e28fb (patch)
treecfdea987c53787a0543718cfbc5fb63f6cfb1061 /stat.c
parent201b3345f6880d2c8400259b1b0cedec4f885460 (diff)
downloadbfs-5bec8030c77b735147cdf73359bc8f91b19e28fb.tar.xz
stat: Handle statx() not returning some times
/sys/fs/cgroup, for example, doesn't return access times from statx(). That shouldn't matter unless we actually need them, so make it not an error.
Diffstat (limited to 'stat.c')
-rw-r--r--stat.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/stat.c b/stat.c
index b8f1704..8ce13e9 100644
--- a/stat.c
+++ b/stat.c
@@ -148,8 +148,9 @@ static int bfs_statx_impl(int at_fd, const char *at_path, int at_flags, enum bfs
return ret;
}
- if ((xbuf.stx_mask & STATX_BASIC_STATS) != STATX_BASIC_STATS) {
- // Callers shouldn't have to check anything except BFS_STAT_BTIME
+ // Callers shouldn't have to check anything except the times
+ const int guaranteed = STATX_BASIC_STATS ^ (STATX_ATIME | STATX_CTIME | STATX_MTIME);
+ if ((xbuf.stx_mask & guaranteed) != guaranteed) {
errno = EINVAL;
return -1;
}