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

Commit 2ab52180 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "root_canal: Add CLOSE_N_EXEC flag for rootcanal"

parents 022d83e4 ad1efe4a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ class AsyncManager::AsyncFdWatcher {
    }
    // set up the communication channel
    int pipe_fds[2];
    if (pipe2(pipe_fds, O_NONBLOCK)) {
    if (pipe2(pipe_fds, O_NONBLOCK | O_CLOEXEC)) {
      LOG_ERROR(
          "%s:Unable to establish a communication channel to the reading "
          "thread",
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ PosixAsyncSocketConnector::ConnectToRemoteServer(
    const std::chrono::milliseconds timeout) {
  LOG_INFO("Connecting to %s:%d in %d ms", server.c_str(), port,
           (int)timeout.count());
  int socket_fd = socket(AF_INET, SOCK_STREAM, 0);
  int socket_fd = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
  std::shared_ptr<PosixAsyncSocket> pas =
      std::make_shared<PosixAsyncSocket>(socket_fd, am_);

+3 −2
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ PosixAsyncSocketServer::PosixAsyncSocketServer(int port, AsyncManager* am)
  struct sockaddr_in listen_address {};
  socklen_t sockaddr_in_size = sizeof(struct sockaddr_in);

  OSI_NO_INTR(listen_fd = socket(AF_INET, SOCK_STREAM, 0));
  OSI_NO_INTR(listen_fd = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0));
  if (listen_fd < 0) {
    LOG_INFO("Error creating socket for test channel.");
    return;
@@ -99,7 +99,8 @@ bool PosixAsyncSocketServer::Connected() {

void PosixAsyncSocketServer::AcceptSocket() {
  int accept_fd = 0;
  OSI_NO_INTR(accept_fd = accept(server_socket_->fd(), NULL, NULL));
  OSI_NO_INTR(accept_fd =
                  accept4(server_socket_->fd(), NULL, NULL, SOCK_CLOEXEC));

  if (accept_fd < 0) {
    LOG_INFO("Error accepting test channel connection errno=%d (%s).", errno,