Fix size_t/off_t mixup in std::filesystem.
authorDan Albert <danalbert@google.com>
Tue, 15 Jan 2019 19:16:25 +0000 (19:16 +0000)
committerDan Albert <danalbert@google.com>
Tue, 15 Jan 2019 19:16:25 +0000 (19:16 +0000)
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

libcxx/src/filesystem/operations.cpp

index e3bbc7b..b410618 100644 (file)
@@ -439,7 +439,8 @@ file_status posix_lstat(path const& p, error_code* ec) {
   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;