AU: shift to use new TMPDIR-enabled temp file
The main change here is that delta generator will now create all
temporary files in TMPDIR, if set. Other than that, we're converting all
other temporary file/directory creation to use the new functions.
- All temps of the form "/tmp/foo" are converted to "foo": this
preserves the behavior in the default case (where TMPDIR is not set),
yet will do the right thing if run with a different TMPDIR.
- A few other cases (for example, temp file created relative to the
current working directory) will now be created in TMPDIR or /tmp.
These are all in unit tests and the transition makes sense anyway.
Note that two temp file/directory creation calls in actual UE code were
using "/tmp/..." and were not changed. This will ensure that they are
resilient to TMPDIR changes and will always be allocated in the same
(hard-coded) location.
BUG=chromium:253622
TEST=Unit tests.
Change-Id: Ia1208963a0e2fcd43b8d6f92bb3d1b7459e930a2
Reviewed-on: https://chromium-review.googlesource.com/182247
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/full_update_generator_unittest.cc b/full_update_generator_unittest.cc
index 16aa568..c04773e 100644
--- a/full_update_generator_unittest.cc
+++ b/full_update_generator_unittest.cc
@@ -33,14 +33,14 @@
off_t new_rootfs_size = new_root.size() - 2 * 1024 * 1024;
string new_root_path;
- EXPECT_TRUE(utils::MakeTempFile("/tmp/NewFullUpdateTest_R.XXXXXX",
+ EXPECT_TRUE(utils::MakeTempFile("NewFullUpdateTest_R.XXXXXX",
&new_root_path,
NULL));
ScopedPathUnlinker new_root_path_unlinker(new_root_path);
EXPECT_TRUE(WriteFileVector(new_root_path, new_root));
string new_kern_path;
- EXPECT_TRUE(utils::MakeTempFile("/tmp/NewFullUpdateTest_K.XXXXXX",
+ EXPECT_TRUE(utils::MakeTempFile("NewFullUpdateTest_K.XXXXXX",
&new_kern_path,
NULL));
ScopedPathUnlinker new_kern_path_unlinker(new_kern_path);
@@ -48,7 +48,7 @@
string out_blobs_path;
int out_blobs_fd;
- EXPECT_TRUE(utils::MakeTempFile("/tmp/NewFullUpdateTest_D.XXXXXX",
+ EXPECT_TRUE(utils::MakeTempFile("NewFullUpdateTest_D.XXXXXX",
&out_blobs_path,
&out_blobs_fd));
ScopedPathUnlinker out_blobs_path_unlinker(out_blobs_path);