Merge "patchoat: DisableAutoClose when patching in place"
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 @@
         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;