diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2018-12-19 23:46:24 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2018-12-19 23:46:24 -0500 |
commit | 5bec8030c77b735147cdf73359bc8f91b19e28fb (patch) | |
tree | cfdea987c53787a0543718cfbc5fb63f6cfb1061 /stat.c | |
parent | 201b3345f6880d2c8400259b1b0cedec4f885460 (diff) | |
download | bfs-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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; } |