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/02/15 21:40:42 UTC
[6/7] mesos git commit: Stout: Made `os::mktemp` fully cross-platform.
Stout: Made `os::mktemp` fully cross-platform.
This brings `os::mktemp` in line with `os::mkdtemp` (one is a file,
the other is a directory). Both functions should now be cross-platform
in that they will create a file/directory in the platform's temporary
directory of choice by default.
Review: https://reviews.apache.org/r/56504/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/199d3941
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/199d3941
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/199d3941
Branch: refs/heads/master
Commit: 199d3941b42f5b5e1025df0f4d9aeee2e008fed4
Parents: ccbcf00
Author: Alex Clemmer <cl...@gmail.com>
Authored: Tue Feb 14 14:14:55 2017 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Wed Feb 15 13:40:20 2017 -0800
----------------------------------------------------------------------
3rdparty/stout/include/stout/os/mktemp.hpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/199d3941/3rdparty/stout/include/stout/os/mktemp.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/mktemp.hpp b/3rdparty/stout/include/stout/os/mktemp.hpp
index 231234f..55cf8b8 100644
--- a/3rdparty/stout/include/stout/os/mktemp.hpp
+++ b/3rdparty/stout/include/stout/os/mktemp.hpp
@@ -19,6 +19,7 @@
#include <string>
#include <stout/error.hpp>
+#include <stout/path.hpp>
#include <stout/try.hpp>
#ifdef __WINDOWS__
@@ -27,6 +28,7 @@
#include <stout/os/close.hpp>
#include <stout/os/int_fd.hpp>
+#include <stout/os/temp.hpp>
namespace os {
@@ -35,7 +37,8 @@ namespace os {
// template may be any path with _6_ `Xs' appended to it, for example
// /tmp/temp.XXXXXX. The trailing `Xs' are replaced with a unique
// alphanumeric combination.
-inline Try<std::string> mktemp(const std::string& path = "/tmp/XXXXXX")
+inline Try<std::string> mktemp(
+ const std::string& path = path::join(os::temp(), "XXXXXX"))
{
char* temp = new char[path.size() + 1];
::memcpy(temp, path.c_str(), path.size() + 1);