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/payload_signer.cc b/payload_signer.cc
index 3ed2a49..c962195 100644
--- a/payload_signer.cc
+++ b/payload_signer.cc
@@ -204,12 +204,12 @@
   LOG(INFO) << "Signing hash with private key: " << private_key_path;
   string sig_path;
   TEST_AND_RETURN_FALSE(
-      utils::MakeTempFile("/tmp/signature.XXXXXX", &sig_path, NULL));
+      utils::MakeTempFile("signature.XXXXXX", &sig_path, NULL));
   ScopedPathUnlinker sig_path_unlinker(sig_path);
 
   string hash_path;
   TEST_AND_RETURN_FALSE(
-      utils::MakeTempFile("/tmp/hash.XXXXXX", &hash_path, NULL));
+      utils::MakeTempFile("hash.XXXXXX", &hash_path, NULL));
   ScopedPathUnlinker hash_path_unlinker(hash_path);
   // We expect unpadded SHA256 hash coming in
   TEST_AND_RETURN_FALSE(hash.size() == 32);
@@ -265,7 +265,7 @@
 
   string x_path;
   TEST_AND_RETURN_FALSE(
-      utils::MakeTempFile("/tmp/signed_data.XXXXXX", &x_path, NULL));
+      utils::MakeTempFile("signed_data.XXXXXX", &x_path, NULL));
   ScopedPathUnlinker x_path_unlinker(x_path);
   TEST_AND_RETURN_FALSE(utils::WriteFile(x_path.c_str(), "x", 1));