diff options
author | Davide Italiano <davide@freebsd.org> | 2017-11-07 00:47:04 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2017-11-07 00:47:04 +0000 |
commit | 1f465aa64a5e1120b20a320c2df20b967f14e3a5 (patch) | |
tree | 5f78c08de74e6dda76b7e19b46e3b849f5f9ca71 /llvm/lib/Support/Unix/Path.inc | |
parent | 25a09dd40853d6fb1137d7847f3cca1a1e813caf (diff) | |
download | bcm5719-llvm-1f465aa64a5e1120b20a320c2df20b967f14e3a5.tar.gz bcm5719-llvm-1f465aa64a5e1120b20a320c2df20b967f14e3a5.zip |
[Support/UNIX] posix_fallocate() can fail with EINVAL.
According to the docs on opegroup.org, the function can return
EINVAL if:
The len argument is less than zero, or the offset argument is less
than zero, or the underlying file system does not support this
operation.
I'd say it's a peculiar choice (when EONOTSUPP is right there), but
let's keep POSIX happy for now. This was independently discovered
by Mark Millard (on FreeBSD/ZFS).
Quickly ack'ed by Rui on IRC.
llvm-svn: 317535
Diffstat (limited to 'llvm/lib/Support/Unix/Path.inc')
-rw-r--r-- | llvm/lib/Support/Unix/Path.inc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc index 781a911ed57..2ecb97316c8 100644 --- a/llvm/lib/Support/Unix/Path.inc +++ b/llvm/lib/Support/Unix/Path.inc @@ -426,7 +426,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 |