lld: accept EINVAL to indicate posix_fallocate is unsupported

As of r325320 posix_fallocate on a ZFS filesystem returns EINVAL to
indicate that the operation is not supported. (I think this is a strange
choice of errno on the part of POSIX.)

PR:		223383, 223440
Reported by:	Mark Millard
Tested by:	Mark Millard
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Ed Maste 2017-11-05 00:51:53 +00:00
parent b91ed584d4
commit cdf46f9946
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325420

View File

@ -427,7 +427,7 @@ std::error_code resize_file(int FD, uint64_t Size) {
// If we have posix_fallocate use it. Unlike ftruncate it always allocates
// space, so we get an error if the disk is full.
if (int Err = ::posix_fallocate(FD, 0, Size)) {
if (Err != EOPNOTSUPP)
if (Err != EINVAL && Err != EOPNOTSUPP)
return std::error_code(Err, std::generic_category());
}
#endif