Create temporary files in the system's temp directory.
In Brillo, the temporary directory might not be /tmp. This patch uses
base::GetTempDir() instead and removes the hard-coded mentions of /tmp
when creating temporary directories.
Bug: 22024447
Test: `update_engine_client --update --omaha_url=...` mounts /system on the temp directory under /data/local/tmp
Change-Id: Ibb52cae01419511f91bdfbf6f228b74a581edde9
diff --git a/utils.h b/utils.h
index 6668c39..252feab 100644
--- a/utils.h
+++ b/utils.h
@@ -131,9 +131,8 @@
// If |base_filename_template| is neither absolute (starts with "/") nor
// explicitly relative to the current working directory (starts with "./" or
-// "../"), then it is prepended the value of TMPDIR, which defaults to /tmp if
-// it isn't set or is empty. It then calls mkstemp(3) with the resulting
-// template. Writes the name of a new temporary file to |filename|. If |fd| is
+// "../"), then it is prepended the system's temporary directory. On success,
+// stores the name of the new temporary file in |filename|. If |fd| is
// non-null, the file descriptor returned by mkstemp is written to it and
// kept open; otherwise, it is closed. The template must end with "XXXXXX".
// Returns true on success.
@@ -141,12 +140,11 @@
std::string* filename,
int* fd);
-// If |base_filename_template| is neither absolute (starts with "/") nor
+// If |base_dirname_template| is neither absolute (starts with "/") nor
// explicitly relative to the current working directory (starts with "./" or
-// "../"), then it is prepended the value of TMPDIR, which defaults to /tmp if
-// it isn't set or is empty. It then calls mkdtemp() with the resulting
-// template. Writes the name of the new temporary directory to |dirname|.
-// The template must end with "XXXXXX". Returns true on success.
+// "../"), then it is prepended the system's temporary directory. On success,
+// stores the name of the new temporary directory in |dirname|. The template
+// must end with "XXXXXX". Returns true on success.
bool MakeTempDirectory(const std::string& base_dirname_template,
std::string* dirname);