Merge "Use flags = 0 to avoid fd closing for child updater process" am: 50bda24f1e am: 111663d893
am: 2796a9d00f
Change-Id: Ib6473290e13400c791b8e31ffeab0e1507d270bb
diff --git a/install.cpp b/install.cpp
index b7fb788..ffa39e4 100644
--- a/install.cpp
+++ b/install.cpp
@@ -342,7 +342,9 @@
// The updater in child process writes to the pipe to communicate with recovery.
android::base::unique_fd pipe_read, pipe_write;
- if (!android::base::Pipe(&pipe_read, &pipe_write)) {
+ // Explicitly disable O_CLOEXEC using 0 as the flags (last) parameter to Pipe
+ // so that the child updater process will recieve a non-closed fd.
+ if (!android::base::Pipe(&pipe_read, &pipe_write, 0)) {
PLOG(ERROR) << "Failed to create pipe for updater-recovery communication";
return INSTALL_CORRUPT;
}