fastbootd: add O_CLOEXEC/O_BINARY for OpenPartition

O_CLOEXEC ensures fastbootd does not leak fds to the parent
process (recovery).

O_BINARY has no effect in Linux, but it is explicit that
the file (partition) to read is a binary file.

Test: pass
Bug: 173654501

Change-Id: Idba922965ce666af1b7ee460ec7449fabd511c35
diff --git a/fastboot/device/utility.cpp b/fastboot/device/utility.cpp
index 4c84798..f9267e0 100644
--- a/fastboot/device/utility.cpp
+++ b/fastboot/device/utility.cpp
@@ -90,7 +90,8 @@
         return false;
     }
 
-    int flags = O_EXCL | (read ? O_RDONLY : O_WRONLY);
+    int flags = (read ? O_RDONLY : O_WRONLY);
+    flags |= (O_EXCL | O_CLOEXEC | O_BINARY);
     unique_fd fd(TEMP_FAILURE_RETRY(open(handle->path().c_str(), flags)));
     if (fd < 0) {
         PLOG(ERROR) << "Failed to open block device: " << handle->path();