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

Unified Diff: base/file_util_posix.cc

Issue 83001: ImportantFileWriter (Closed)
Patch Set: share more code Created 11 years, 8 months 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 | « base/file_util.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_posix.cc
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 073c58ed0cbcdc7b6d632ecea68844dad87f8d06..16c235d2ff239f3cea8d8508c53b63d3b28d42f9 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -369,30 +369,20 @@ bool CreateTemporaryFileName(FilePath* path) {
return true;
}
-FILE* CreateAndOpenTemporaryFile(FilePath* path) {
- FilePath directory;
- if (!GetTempDir(&directory))
- return false;
-
- int fd = CreateAndOpenFdForTemporaryFile(directory, path);
- if (fd < 0)
- return NULL;
-
- FILE *fp = fdopen(fd, "a+");
- return fp;
-}
-
FILE* CreateAndOpenTemporaryShmemFile(FilePath* path) {
FilePath directory;
if (!GetShmemTempDir(&directory))
return false;
- int fd = CreateAndOpenFdForTemporaryFile(directory, path);
+ return CreateAndOpenTemporaryFileInDir(directory, path);
+}
+
+FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path) {
+ int fd = CreateAndOpenFdForTemporaryFile(dir, path);
if (fd < 0)
return NULL;
- FILE *fp = fdopen(fd, "a+");
- return fp;
+ return fdopen(fd, "a+");
}
bool CreateTemporaryFileNameInDir(const std::wstring& dir,
« no previous file with comments | « base/file_util.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698