aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Peckham <bpeckham@google.com>2019-03-29 06:57:42 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-03-29 06:57:42 -0700
commit575fc7ec07497bb3e629f4498ddfe996a63c2291 (patch)
tree12d2322e0efd74c364df7bb95948bd2f57e1b242
parent2cc882c2f86c63177027570bd68d4c3a7c034e13 (diff)
parent2796a9d00f418075ae84f48e247c9727acb1e221 (diff)
downloadrecovery-575fc7ec07497bb3e629f4498ddfe996a63c2291.tar.gz
Merge "Use flags = 0 to avoid fd closing for child updater process" am: 50bda24f1e am: 111663d893
am: 2796a9d00f Change-Id: Ib6473290e13400c791b8e31ffeab0e1507d270bb
-rw-r--r--install.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/install.cpp b/install.cpp
index b7fb7887..ffa39e46 100644
--- a/install.cpp
+++ b/install.cpp
@@ -342,7 +342,9 @@ static int try_update_binary(const std::string& package, ZipArchiveHandle zip, b
// 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;
}