Fix size_t/off_t mixup in std::filesystem.
Summary: ftruncate takes an off_t, not a size_t.
Reviewers: EricWF, mclow.lists
Reviewed By: EricWF
Subscribers: christof, ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D56578
llvm-svn: 351226
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 45b511fb05f9073d72c1511bebd772f8e9dd6f35
diff --git a/src/filesystem/operations.cpp b/src/filesystem/operations.cpp
index e3bbc7b..b410618 100644
--- a/src/filesystem/operations.cpp
+++ b/src/filesystem/operations.cpp
@@ -439,7 +439,8 @@
return posix_lstat(p, path_stat, ec);
}
-bool posix_ftruncate(const FileDescriptor& fd, size_t to_size, error_code& ec) {
+// http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html
+bool posix_ftruncate(const FileDescriptor& fd, off_t to_size, error_code& ec) {
if (::ftruncate(fd.fd, to_size) == -1) {
ec = capture_errno();
return true;