Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1267)

Unified Diff: third_party/crashpad/crashpad/test/scoped_temp_dir_posix.cc

Issue 2478633002: Update Crashpad to b47bf6c250c6b825dee1c5fbad9152c2c962e828 (Closed)
Patch Set: mac comment 2 Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/crashpad/crashpad/test/paths_win.cc ('k') | third_party/crashpad/crashpad/test/test.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/crashpad/crashpad/test/scoped_temp_dir_posix.cc
diff --git a/third_party/crashpad/crashpad/test/scoped_temp_dir_posix.cc b/third_party/crashpad/crashpad/test/scoped_temp_dir_posix.cc
index 34db76f3115c0b4a8cf3e1f284a3c74b3f66db79..0368103698539a039190137a050cafa687a980a6 100644
--- a/third_party/crashpad/crashpad/test/scoped_temp_dir_posix.cc
+++ b/third_party/crashpad/crashpad/test/scoped_temp_dir_posix.cc
@@ -15,10 +15,12 @@
#include "test/scoped_temp_dir.h"
#include <dirent.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "base/logging.h"
+#include "build/build_config.h"
#include "gtest/gtest.h"
#include "test/errors.h"
@@ -33,9 +35,25 @@ void ScopedTempDir::Rename() {
// static
base::FilePath ScopedTempDir::CreateTemporaryDirectory() {
- char dir_template[] = "/tmp/org.chromium.crashpad.test.XXXXXX";
- PCHECK(mkdtemp(dir_template)) << "mkdtemp " << dir_template;
- return base::FilePath(dir_template);
+ char* tmpdir = getenv("TMPDIR");
+ std::string dir;
+ if (tmpdir && tmpdir[0] != '\0') {
+ dir.assign(tmpdir);
+ } else {
+#if defined(OS_ANDROID)
+ dir.assign("/data/local/tmp");
+#else
+ dir.assign("/tmp");
+#endif
+ }
+
+ if (dir[dir.size() - 1] != '/') {
+ dir.append(1, '/');
+ }
+ dir.append("org.chromium.crashpad.test.XXXXXX");
+
+ PCHECK(mkdtemp(&dir[0])) << "mkdtemp " << dir;
+ return base::FilePath(dir);
}
// static
« no previous file with comments | « third_party/crashpad/crashpad/test/paths_win.cc ('k') | third_party/crashpad/crashpad/test/test.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698