]> git.ipfire.org Git - thirdparty/coreutils.git/commit
stat: fix determination of max name length on BSD systems
authorPádraig Brady <P@draigBrady.com>
Wed, 30 Aug 2017 06:42:54 +0000 (23:42 -0700)
committerPádraig Brady <P@draigBrady.com>
Wed, 30 Aug 2017 06:42:54 +0000 (23:42 -0700)
commitf169345506ac5a095cd100d016c84dc44b33e851
tree2834f72f231fd5e397208da9a1cd623ba3c8e275
parent3ebdc3e1af846de4b488b04406e07c7bac12ae1b
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.
NEWS
m4/stat-prog.m4
src/stat.c
tests/ln/sf-1.sh