summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2017-08-29 23:42:54 -0700
committerPádraig Brady <P@draigBrady.com>2017-08-29 23:42:54 -0700
commitf169345506ac5a095cd100d016c84dc44b33e851 (patch)
tree2834f72f231fd5e397208da9a1cd623ba3c8e275 /m4
parent3ebdc3e1af846de4b488b04406e07c7bac12ae1b (diff)
downloadcoreutils-f169345506ac5a095cd100d016c84dc44b33e851.tar.gz
stat: fix determination of max name length on BSD systems
We only use one of statfs or statvfs for `stat -f` and on the BSDs we use statfs which doesn't have the f_namelen member. However on OpenBSD and later FreeBSD systems statfs does provide f_namemax, so use that. * NEWS: Mention the improvement for OpenBSD and FreeBSD. * m4/stat-prog.m4: Check for f_namemax in the statfs struct. * src/stat.c: Return '?' rather than '*' when we can't determine the max length of the file system. * tests/ln/sf-1.sh: This test was failing on all BSDs due to '*' being returned for the max length which caused the test to attempt to create 1Mi+1 names. The test now uses a short name when we can't determine the max name length to use. Reported by Assaf Gordon on various BSD based systems.
Diffstat (limited to 'm4')
-rw-r--r--m4/stat-prog.m45
1 files changed, 3 insertions, 2 deletions
diff --git a/m4/stat-prog.m4 b/m4/stat-prog.m4
index 8d2923212..13c2dbbeb 100644
--- a/m4/stat-prog.m4
+++ b/m4/stat-prog.m4
@@ -72,8 +72,9 @@ AC_INCLUDES_DEFAULT
[AC_DEFINE([STRUCT_STATVFS_F_FSID_IS_INTEGER], [1],
[Define to 1 if the f_fsid member of struct statvfs is an integer.])])
else
- AC_CHECK_MEMBERS([struct statfs.f_namelen, struct statfs.f_type,
- struct statfs.f_frsize],,, [$statfs_includes])
+ AC_CHECK_MEMBERS([struct statfs.f_namelen, struct statfs.f_namemax,
+ struct statfs.f_type, struct statfs.f_frsize],,,
+ [$statfs_includes])
if test $ac_cv_header_OS_h != yes; then
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(