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

Commit 17ba68d0 authored by Elliott Hughes's avatar Elliott Hughes
Browse files

Clean up CLOEXEC in debuggerd.

Change-Id: I1cd75f6a8f98e99f4a4fedfc706103ce34035765
parent fbaefc4d
Loading
Loading
Loading
Loading
+6 −9
Original line number Original line Diff line number Diff line
@@ -685,10 +685,9 @@ static int do_server() {
  act.sa_flags = SA_NOCLDWAIT;
  act.sa_flags = SA_NOCLDWAIT;
  sigaction(SIGCHLD, &act, 0);
  sigaction(SIGCHLD, &act, 0);


  int s = socket_local_server(SOCKET_NAME, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM);
  int s = socket_local_server(SOCKET_NAME, ANDROID_SOCKET_NAMESPACE_ABSTRACT,
  if (s < 0)
                              SOCK_STREAM | SOCK_CLOEXEC);
    return 1;
  if (s == -1) return 1;
  fcntl(s, F_SETFD, FD_CLOEXEC);


  ALOGI("debuggerd: starting\n");
  ALOGI("debuggerd: starting\n");


@@ -698,14 +697,12 @@ static int do_server() {
    socklen_t alen = sizeof(ss);
    socklen_t alen = sizeof(ss);


    ALOGV("waiting for connection\n");
    ALOGV("waiting for connection\n");
    int fd = accept(s, addrp, &alen);
    int fd = accept4(s, addrp, &alen, SOCK_CLOEXEC);
    if (fd < 0) {
    if (fd == -1) {
      ALOGV("accept failed: %s\n", strerror(errno));
      ALOGE("accept failed: %s\n", strerror(errno));
      continue;
      continue;
    }
    }


    fcntl(fd, F_SETFD, FD_CLOEXEC);

    handle_request(fd);
    handle_request(fd);
  }
  }
  return 0;
  return 0;