Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08ba1ad9 authored by Bill Peckham's avatar Bill Peckham
Browse files

Use flags = 0 to avoid fd closing for child updater process

If we use the default parameter we'll get O_CLOEXEC, which will close the fd
that we pass to the child process, which will cause it to fail. Passing zero
avoids the problem.

Bug: 122813742
Test: Verify that non-A/B OTA update is successful.
Change-Id: Ia61bc7260f17d9209715583e6ded69e1196ed3f6
parent 047582b5
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;
  }