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:29 UTC
[43/50] mesos git commit: Windows: Deleted `os::hstrerror()` as it is
unused.
Windows: Deleted `os::hstrerror()` as it is unused.
Review: https://reviews.apache.org/r/60339/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5df5750d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5df5750d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5df5750d
Branch: refs/heads/master
Commit: 5df5750d473d61f1feb35b06e00e7211c74ef034
Parents: 54b4f0e
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Mon Jul 10 15:30:09 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Jul 10 17:15:39 2017 -0700
----------------------------------------------------------------------
3rdparty/stout/include/stout/windows/os.hpp | 37 +-----------------------
3rdparty/stout/tests/os/strerror_tests.cpp | 33 ++-------------------
2 files changed, 4 insertions(+), 66 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/5df5750d/3rdparty/stout/include/stout/windows/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/windows/os.hpp b/3rdparty/stout/include/stout/windows/os.hpp
index e24022e..1a5abda 100644
--- a/3rdparty/stout/include/stout/windows/os.hpp
+++ b/3rdparty/stout/include/stout/windows/os.hpp
@@ -356,42 +356,7 @@ inline Result<pid_t> waitpid(long pid, int* status, int options)
}
-inline std::string hstrerror(int err)
-{
- char buffer[1024];
- DWORD format_error = 0;
-
- // NOTE: Per the Linux documentation[1], `h_errno` can have only one of the
- // following errors.
- switch (err) {
- case WSAHOST_NOT_FOUND:
- case WSANO_DATA:
- case WSANO_RECOVERY:
- case WSATRY_AGAIN: {
- format_error = ::FormatMessage(
- FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- nullptr,
- err,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- buffer,
- sizeof(buffer),
- nullptr);
- break;
- }
- default: {
- return "Unknown resolver error";
- }
- }
-
- if (format_error == 0) {
- // If call to `FormatMessage` fails, then we choose to output the error
- // code rather than call `FormatMessage` again.
- return "os::hstrerror: Call to `FormatMessage` failed with error code" +
- std::to_string(GetLastError());
- } else {
- return buffer;
- }
-}
+inline std::string hstrerror(int err) = delete;
inline Try<Nothing> chown(
http://git-wip-us.apache.org/repos/asf/mesos/blob/5df5750d/3rdparty/stout/tests/os/strerror_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/os/strerror_tests.cpp b/3rdparty/stout/tests/os/strerror_tests.cpp
index f69a4d3..6a69d52 100644
--- a/3rdparty/stout/tests/os/strerror_tests.cpp
+++ b/3rdparty/stout/tests/os/strerror_tests.cpp
@@ -23,25 +23,6 @@
using std::string;
-#ifdef __WINDOWS__
-const string errorMessage(int err)
-{
- char buffer[1024];
-
- ::FormatMessage(
- FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- nullptr,
- err,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- buffer,
- sizeof(buffer),
- nullptr);
-
- return buffer;
-}
-#endif // __WINDOWS__
-
-
TEST(StrerrorTest, ValidErrno)
{
EXPECT_EQ(::strerror(ENODEV), os::strerror(ENODEV));
@@ -62,25 +43,17 @@ TEST(StrerrorTest, InvalidErrno)
// The Linux documentation[1] on `herrno` indicates there are only 4 possible
-// values that `h_errno` can have. Here we test that the Windows implementation
-// will return "Unknown resolver error" for other error values.
+// values that `h_errno` can have.
//
// [1] http://linux.die.net/man/3/hstrerror
+#ifndef __WINDOWS__
TEST(StrerrorTest, ValidHerrno)
{
-#ifdef __WINDOWS__
- EXPECT_EQ("Unknown resolver error", os::hstrerror(ENODEV));
- EXPECT_EQ("Unknown resolver error", os::hstrerror(EINTR));
- EXPECT_EQ(::errorMessage(HOST_NOT_FOUND), os::hstrerror(HOST_NOT_FOUND));
- EXPECT_EQ(::errorMessage(NO_DATA), os::hstrerror(NO_DATA));
- EXPECT_EQ(::errorMessage(NO_RECOVERY), os::hstrerror(NO_RECOVERY));
- EXPECT_EQ(::errorMessage(TRY_AGAIN), os::hstrerror(TRY_AGAIN));
-#else
EXPECT_EQ(::hstrerror(ENODEV), os::hstrerror(ENODEV));
EXPECT_EQ(::hstrerror(EINTR), os::hstrerror(EINTR));
EXPECT_EQ(::hstrerror(HOST_NOT_FOUND), os::hstrerror(HOST_NOT_FOUND));
EXPECT_EQ(::hstrerror(NO_DATA), os::hstrerror(NO_DATA));
EXPECT_EQ(::hstrerror(NO_RECOVERY), os::hstrerror(NO_RECOVERY));
EXPECT_EQ(::hstrerror(TRY_AGAIN), os::hstrerror(TRY_AGAIN));
-#endif // __WINDOWS__
}
+#endif // __WINDOWS__