summaryrefslogtreecommitdiffstats
path: root/stat.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2021-12-10 14:23:15 -0500
committerTavian Barnes <tavianator@tavianator.com>2021-12-10 14:23:15 -0500
commit23a4c2369ac1007e170eaa3089b60b66392bb114 (patch)
treedd1898e33451fa5167e12da738452837b37a9fd6 /stat.c
parent26c0bb082ca1c03aa4eb788385d4fecf7cc46a6b (diff)
downloadbfs-23a4c2369ac1007e170eaa3089b60b66392bb114.tar.xz
stat: Work around GNU Hurd bug
fstatat(fd, "", buf, AT_EMPTY_PATH) fails with a nonsense errno on Hurd. Since fstat() itself works fine, just use that. Link: https://lists.gnu.org/archive/html/bug-hurd/2021-12/msg00001.html
Diffstat (limited to 'stat.c')
-rw-r--r--stat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/stat.c b/stat.c
index 6042ffb..47e60b6 100644
--- a/stat.c
+++ b/stat.c
@@ -325,7 +325,8 @@ int bfs_stat(int at_fd, const char *at_path, enum bfs_stat_flags flags, struct b
return bfs_stat_explicit(at_fd, at_path, at_flags, flags, buf);
}
-#ifdef AT_EMPTY_PATH
+ // Check __GNU__ to work around https://lists.gnu.org/archive/html/bug-hurd/2021-12/msg00001.html
+#if defined(AT_EMPTY_PATH) && !__GNU__
static bool has_at_ep = true;
if (has_at_ep) {
at_flags |= AT_EMPTY_PATH;