Parcourir la source

Kernel: socket() with SOCK_CLOEXEC was setting the wrong fd flag.

Turns out FD_CLOEXEC and O_CLOEXEC are different values. Silly mistake.
I noticed that Terminal's shell process still had the Terminal's window
server connection open, albeit in a broken state.
Andreas Kling il y a 6 ans
Parent
commit
7bb00ea1e3
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      Kernel/Process.cpp

+ 1 - 1
Kernel/Process.cpp

@@ -2236,7 +2236,7 @@ int Process::sys$socket(int domain, int type, int protocol)
     auto descriptor = FileDescriptor::create(move(socket));
     auto descriptor = FileDescriptor::create(move(socket));
     unsigned flags = 0;
     unsigned flags = 0;
     if (type & SOCK_CLOEXEC)
     if (type & SOCK_CLOEXEC)
-        flags |= O_CLOEXEC;
+        flags |= FD_CLOEXEC;
     if (type & SOCK_NONBLOCK)
     if (type & SOCK_NONBLOCK)
         descriptor->set_blocking(false);
         descriptor->set_blocking(false);
     m_fds[fd].set(move(descriptor), flags);
     m_fds[fd].set(move(descriptor), flags);