Fix temp file locations used in dump_vpd_log.

The intention is to keep the temp files on the same file system so file
renaming is atomic. This broke when we switched to encrypted stateful,
which made /var/tmp part of the encrypted file system, but the final
cache files remained in the unencrypted stateful file system. This
change puts the temporary files alongside their final destinations to
minimize the risk of this breaking again. Also, we now sync the source
file data to disk in order to not lose file contents on unclean
shutdown.

BUG=chromium:379090
TEST=Manual: VPD cache file generation is resilient to hard system resets, see bug for more context.

Change-Id: I1e24d07f07c6fb037db8b8c4ff325d4fe53365d8
Reviewed-on: https://chromium-review.googlesource.com/224282
Tested-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Thiemo Nagel <tnagel@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Mattias Nissler <mnissler@chromium.org>
1 file changed
tree: 882257ea8e0c995d41f1c6ba5270345c132e85d5
  1. include/
  2. init/
  3. lib/
  4. tests/
  5. util/
  6. LICENSE
  7. Makefile
  8. OWNERS
  9. README
  10. vpd.c