diff options
| author | Mykola Perehudov <nexec@users.noreply.github.com> | 2023-07-06 12:39:02 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-06 11:39:02 +0200 |
| commit | 0c974b72365ffaa69d52ee39944f61709b9e1a81 (patch) | |
| tree | a277990f723417afbe6d1472c34447426969fb50 /src/debug | |
| parent | 8407a9af0a333ade66d4deff7ef654a4594fe58f (diff) | |
Avoid passing control unix socket descriptors to children (#2656)
Add SOCK_CLOEXEC flags to server side connection FDs to make them
closed during execve(2).
Diffstat (limited to 'src/debug')
| -rw-r--r-- | src/debug/HyprCtl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 58099bc8..c7a5e41c 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -1305,7 +1305,7 @@ int hyprCtlFDTick(int fd, uint32_t mask, void* data) { sockaddr_in clientAddress; socklen_t clientSize = sizeof(clientAddress); - const auto ACCEPTEDCONNECTION = accept(HyprCtl::iSocketFD, (sockaddr*)&clientAddress, &clientSize); + const auto ACCEPTEDCONNECTION = accept4(HyprCtl::iSocketFD, (sockaddr*)&clientAddress, &clientSize, SOCK_CLOEXEC); char readBuffer[1024]; @@ -1336,7 +1336,7 @@ int hyprCtlFDTick(int fd, uint32_t mask, void* data) { void HyprCtl::startHyprCtlSocket() { - iSocketFD = socket(AF_UNIX, SOCK_STREAM, 0); + iSocketFD = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); if (iSocketFD < 0) { Debug::log(ERR, "Couldn't start the Hyprland Socket. (1) IPC will not work."); |
