ART: Do not unlink unreadable ELF files

Unlinking can be racy with respect to secondary oat files.

Bug: 17496483

(cherry picked from commit 00503dad8139dcf7b7fc7986ace93e3e45198096)

Change-Id: I53f92a924b34dfcf50d7e02487c5f8f23de627ca
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index 7375428..c621e88 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -93,13 +93,9 @@
     }
     ret.reset(OpenElfFile(file.get(), location, requested_base, false, executable, error_msg));
 
-    // Opening the file failed. Try to delete it and maybe we have more luck after it gets
-    // regenerated.
-    if (ret.get() == nullptr) {
-      LOG(WARNING) << "Attempting to unlink oat file " << filename << " that could not be opened. "
-                   << "Error was: " << error_msg;
-      unlink(file->GetPath().c_str());  // Try to remove the file.
-    }
+    // It would be nice to unlink here. But we might have opened the file created by the
+    // ScopedLock, which we better not delete to avoid races. TODO: Investigate how to fix the API
+    // to allow removal when we know the ELF must be borked.
   }
   return ret.release();
 }