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

Commit 02b1dffe authored by Josh Gao's avatar Josh Gao Committed by android-build-merger
Browse files

Merge "crash_dump: make output fd O_APPEND." am: a70f1133

am: 9fcaf511

Change-Id: I522958406a39bd249492d54b3a0b940250cef65e
parents d87e0261 9fcaf511
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -155,6 +155,14 @@ static bool tombstoned_connect(pid_t pid, unique_fd* tombstoned_socket, unique_f
    return false;
  }

  // Make the fd O_APPEND so that our output is guaranteed to be at the end of a file.
  // (This also makes selinux rules consistent, because selinux distinguishes between writing to
  // a regular fd, and writing to an fd with O_APPEND).
  int flags = fcntl(tmp_output_fd.get(), F_GETFL);
  if (fcntl(tmp_output_fd.get(), F_SETFL, flags | O_APPEND) != 0) {
    PLOG(WARNING) << "failed to set output fd flags";
  }

  *tombstoned_socket = std::move(sockfd);
  *output_fd = std::move(tmp_output_fd);
  return true;