You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2017/07/11 01:39:04 UTC

[18/50] mesos git commit: Windows: Updated `os::access()` to support long paths.

Windows: Updated `os::access()` to support long paths.

Review: https://reviews.apache.org/r/60317/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6f30623a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6f30623a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6f30623a

Branch: refs/heads/master
Commit: 6f30623ab84de61ea972a5979a9858d8465c3643
Parents: d91e4be
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Sat Jul 8 22:17:34 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Jul 10 17:15:34 2017 -0700

----------------------------------------------------------------------
 3rdparty/stout/include/stout/os/access.hpp | 14 ++++++++++++--
 3rdparty/stout/include/stout/windows.hpp   |  7 -------
 2 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6f30623a/3rdparty/stout/include/stout/os/access.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/access.hpp b/3rdparty/stout/include/stout/os/access.hpp
index d87762a..a7dea1c 100644
--- a/3rdparty/stout/include/stout/os/access.hpp
+++ b/3rdparty/stout/include/stout/os/access.hpp
@@ -19,14 +19,24 @@
 #include <stout/try.hpp>
 
 #ifdef __WINDOWS__
-#include <stout/windows.hpp> // To be certain we're using the right `access`.
+#include <stout/windows.hpp>
+#include <stout/internal/windows/longpath.hpp>
 #endif // __WINDOWS__
 
 namespace os {
 
 inline Try<bool> access(const std::string& path, int how)
 {
-  if (::access(path.c_str(), how) < 0) {
+  int result;
+
+#ifdef __WINDOWS__
+  std::wstring longpath = ::internal::windows::longpath(path);
+  result = ::_waccess(longpath.data(), how);
+#else
+  result = ::access(path.data(), how);
+#endif
+
+  if (result < 0) {
     if (errno == EACCES) {
       return false;
     } else {

http://git-wip-us.apache.org/repos/asf/mesos/blob/6f30623a/3rdparty/stout/include/stout/windows.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows.hpp b/3rdparty/stout/include/stout/windows.hpp
index d70d436..34273dc 100644
--- a/3rdparty/stout/include/stout/windows.hpp
+++ b/3rdparty/stout/include/stout/windows.hpp
@@ -372,13 +372,6 @@ decltype(_mktemp_s(path, strlen(path) + 1))
 }
 
 
-inline auto access(const char* fileName, int accessMode) ->
-decltype(_access(fileName, accessMode))
-{
-  return _access(fileName, accessMode);
-}
-
-
 // NOTE: Signals do not exist on Windows, so all signals are unknown.
 // If the signal number is unknown, the Posix specification leaves the
 // return value of `strsignal` unspecified.