diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2017-05-10 08:52:29 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-05-10 08:52:31 +0000 |
commit | fbb09a7192b7fda8810604a38548cbf4a347c70c (patch) | |
tree | f79a5481bc8d2c7944f7c4b5a564ef2f36986ef8 | |
parent | 4a9b7174ca37e95e6dd33594ca30c774c8866fa5 (diff) | |
parent | 7bb165779f59bfa1324ca991f64ab98331a410b5 (diff) | |
download | native-fbb09a7192b7fda8810604a38548cbf4a347c70c.tar.gz |
Merge "Always unlink the out_vdex_file."
-rw-r--r-- | cmds/installd/dexopt.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp index 007505c280..797cc1542a 100644 --- a/cmds/installd/dexopt.cpp +++ b/cmds/installd/dexopt.cpp @@ -1209,7 +1209,11 @@ bool open_vdex_files(const char* apk_path, const char* out_oat_path, int dexopt_ if (dexopt_action == DEX2OAT_FOR_BOOT_IMAGE && in_vdex_wrapper_fd->get() != -1 && in_vdex_path_str == out_vdex_path_str) { - out_vdex_wrapper_fd->reset(in_vdex_wrapper_fd->get()); + // We unlink the file in case the invocation of dex2oat fails, to ensure we don't + // have bogus stale vdex files. + out_vdex_wrapper_fd->reset( + in_vdex_wrapper_fd->get(), + [out_vdex_path_str]() { unlink(out_vdex_path_str.c_str()); }); // Disable auto close for the in wrapper fd (it will be done when destructing the out // wrapper). in_vdex_wrapper_fd->DisableAutoClose(); |