summaryrefslogtreecommitdiffstats
path: root/patchoat
diff options
context:
space:
mode:
authorJulien Delayen <julien.delayen@intel.com>2015-03-05 16:37:52 +0100
committerAndreas Gampe <agampe@google.com>2015-03-10 22:15:48 -0700
commita473f510620958e94b586efb5398cb87f263be2f (patch)
tree3fa5a538399a11ec10cc2a654b0a0ce1483ee177 /patchoat
parent81d38f74219774d87389f83f23595ffc8fe814b1 (diff)
downloadart-a473f510620958e94b586efb5398cb87f263be2f.zip
art-a473f510620958e94b586efb5398cb87f263be2f.tar.gz
art-a473f510620958e94b586efb5398cb87f263be2f.tar.bz2
patchoat: DisableAutoClose when patching in place
Installd can give the same input and output when patching directly in the dalvik-cache. For this particular case, we need to DisableAutoClose to avoid closing twice the same fd. Change-Id: Ic1c0f1006f776e6aeb3772c83c52309c78a4bdfd Signed-off-by: Julien Delayen <julien.delayen@intel.com> Signed-off-by: Guilhem IMBERTON <guilhem.imberton@intel.com>
Diffstat (limited to 'patchoat')
-rw-r--r--patchoat/patchoat.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/patchoat/patchoat.cc b/patchoat/patchoat.cc
index 3c6a23d..9584064 100644
--- a/patchoat/patchoat.cc
+++ b/patchoat/patchoat.cc
@@ -1175,6 +1175,9 @@ static int patchoat(int argc, char **argv) {
input_oat_filename = "input-oat-file";
}
input_oat.reset(new File(input_oat_fd, input_oat_filename, false));
+ if (input_oat_fd == output_oat_fd) {
+ input_oat.get()->DisableAutoClose();
+ }
if (input_oat == nullptr) {
// Unlikely, but ensure exhaustive logging in non-0 exit code case
LOG(ERROR) << "Failed to open input oat file by its FD" << input_oat_fd;