summaryrefslogtreecommitdiff
path: root/lib/Support/Unix/Path.inc
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-08 17:12:57 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-08 17:12:57 +0000
commitc46e6a5940c50058e00c0c5f9123fd82e338d29a (patch)
tree89a719d723035c54a190b1f81d329834f1f93336 /lib/Support/Unix/Path.inc
parent148779df305667b6942fee7e758fdf81a6498f38 (diff)
Diffstat (limited to 'lib/Support/Unix/Path.inc')
-rw-r--r--lib/Support/Unix/Path.inc9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index 93f8982196b3c..fa28ba1b6ab6a 100644
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -421,14 +421,15 @@ std::error_code resize_file(int FD, uint64_t Size) {
#if defined(HAVE_POSIX_FALLOCATE)
// 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))
- return std::error_code(Err, std::generic_category());
-#else
+ if (int Err = ::posix_fallocate(FD, 0, Size)) {
+ if (Err != EOPNOTSUPP)
+ return std::error_code(Err, std::generic_category());
+ }
+#endif
// Use ftruncate as a fallback. It may or may not allocate space. At least on
// OS X with HFS+ it does.
if (::ftruncate(FD, Size) == -1)
return std::error_code(errno, std::generic_category());
-#endif
return std::error_code();
}