dex2oat should truncate files opened from file descriptors

Bug: 17622827

(cherry picked from commit aa93129ca54cc897fdc2c8ddd0a7136f7b5632ed)

Change-Id: I5467d488b4a57f7be35c72c16775df5bd5d69a52
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index afc01dc..9e6e958 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -1252,6 +1252,7 @@
   } else {
     oat_file.reset(new File(oat_fd, oat_location));
     oat_file->DisableAutoClose();
+    oat_file->SetLength(0);
   }
   if (oat_file.get() == nullptr) {
     PLOG(ERROR) << "Failed to create oat file: " << oat_location;