Project: mesos
Issue MESOS-5237: The windows version of `os::access` has differing behavior than the POSIX version.
The POSIX version of {{os::access}} looks like this: {code} inline Try access(const std::string& path, int how) { if (::access(path.c_str(), how) < 0) { if (errno == EACCES) { return false; } else { return ErrnoError(); } } return true; } {code} Compare this to the Windows version of {{os::access}} which looks like this following: {code} inline Try access(const std::string& fileName, int how) { if (::_access(fileName.c_str(), how) != 0) { return ErrnoError("access: Could not access path '" + fileName + "'"); } return true; } {code} As we can see, the case where {{errno}} is set to {{EACCES}} is handled differently between the 2 functions. We can actually consolidate the 2 functions by simply using the POSIX version. The challenge is that on POSIX, we should use {{::access}} and {{::_access}} on Windows. Note however, that this problem is already solved, as we have an implementation of {{::access}} for Windows in {{3rdparty/libprocess/3rdparty/stout/include/stout/windows.hpp}} which simply defers to {{::_access}}. Thus, I propose to simply consolidate the 2 implementations.
Story points: 2