diff options
Diffstat (limited to 'base/file_util_posix.cc')
-rw-r--r-- | base/file_util_posix.cc | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index f218460..1835d3a 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, |