-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/66455/
-----------------------------------------------------------

(Updated April 6, 2018, 4:09 p.m.)


Review request for mesos, Akash Gupta, Eric Mumau, John Kordich, Joseph Wu, and 
Michael Park.


Changes
-------

Use `FileEndOfFileInfo` instead of `SetEndOfFile()`.


Summary (updated)
-----------------

Windows: Fixed `os::ftruncate()` to use `FileEndOfFileInfo`.


Bugs: MESOS-8692
    https://issues.apache.org/jira/browse/MESOS-8692


Repository: mesos


Description (updated)
-------

This previously used the CRT API `_chsize_s()`, which required a CRT
integer file descriptor. Instead, we can achieve the same behavior by
calling `SetFileInformationByHandle(FileEndOfFileInfo)`. This is
significantly easier than using `SetEndOfFile()`, as that requires (1)
saving the original position, (2) seeking to the new position, (3)
setting the end of the file at the new position, then (4) seeking back
to the original position. Instead, this method just sets the end of
the file directly based on the given `length`, much like `ftruncate()`
on POSIX systems.


Diffs (updated)
-----

  3rdparty/stout/include/stout/os/windows/ftruncate.hpp 
fc4a8b5040d56fa9766687e44ce17fbe47d9e8f0 


Diff: https://reviews.apache.org/r/66455/diff/2/

Changes: https://reviews.apache.org/r/66455/diff/1-2/


Testing
-------


Thanks,

Andrew Schwartzmeyer

Reply via email to