From 5bec8030c77b735147cdf73359bc8f91b19e28fb Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 19 Dec 2018 23:46:24 -0500 Subject: 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. --- stat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'stat.c') 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; } -- cgit v1.2.3