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

Commit 43ce684e authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Automerger Merge Worker
Browse files

Merge "Fix two problems in the ExecuteBinary function." am: e0561210 am: b16d968e

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1677048

Change-Id: Ia06cfe69ef224be2cbe3abf32df3f83622481861
parents 611a55f0 b16d968e
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -72,7 +72,8 @@ std::unique_ptr<ProcResult> ExecuteBinary(const std::vector<std::string>& argv)
    argv0[i] = argv[i].c_str();
  }
  argv0[argv.size()] = nullptr;
  switch (fork()) {
  int pid = fork();
  switch (pid) {
    case -1: // error
      free(argv0);
      PLOG(ERROR) << "fork";
@@ -104,8 +105,10 @@ std::unique_ptr<ProcResult> ExecuteBinary(const std::vector<std::string>& argv)
      close(stdout[1]);
      close(stderr[1]);
      int status;
      wait(&status);
      waitpid(pid, &status, 0);
      if (!WIFEXITED(status)) {
          close(stdout[0]);
          close(stderr[0]);
          return nullptr;
      }
      std::unique_ptr<ProcResult> result(new ProcResult());