mirror of
https://github.com/hyprwm/Hyprland.git
synced 2026-09-27 09:26:32 -04:00
core: fix a few fd leaks (#14870)
* core: fix a few fd leaks ref #14839 * core: fix a few fd leaks ref #14839
This commit is contained in:
@@ -140,6 +140,7 @@ static void handleUserSignal(int sig) {
|
||||
|
||||
bool CCompositor::setWatchdogFd(int fd) {
|
||||
m_watchdogWriteFd = Hyprutils::OS::CFileDescriptor{fd};
|
||||
m_watchdogWriteFd.setFlags(m_watchdogWriteFd.getFlags() | O_CLOEXEC);
|
||||
return m_watchdogWriteFd.isValid() && !m_watchdogWriteFd.isClosed();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ CConfigWatcher::CConfigWatcher() : m_inotifyFd(inotify_init()) {
|
||||
|
||||
// TODO: make CFileDescriptor take F_GETFL, F_SETFL
|
||||
const int FLAGS = fcntl(m_inotifyFd.get(), F_GETFL, 0);
|
||||
if (fcntl(m_inotifyFd.get(), F_SETFL, FLAGS | O_NONBLOCK) < 0) {
|
||||
if (fcntl(m_inotifyFd.get(), F_SETFL, FLAGS | O_NONBLOCK | O_CLOEXEC) < 0) {
|
||||
Log::logger->log(Log::ERR, "CConfigWatcher couldn't non-block inotify node. Config will not be automatically reloaded");
|
||||
m_inotifyFd.reset();
|
||||
return;
|
||||
|
||||
@@ -155,6 +155,10 @@ bool CHyprlandInstance::run(bool safeMode) {
|
||||
m_wakeupRead = CFileDescriptor{pipefds[0]};
|
||||
m_wakeupWrite = CFileDescriptor{pipefds[1]};
|
||||
|
||||
m_fromHlPid.setFlags(m_fromHlPid.getFlags() | O_CLOEXEC);
|
||||
m_wakeupRead.setFlags(m_wakeupRead.getFlags() | O_CLOEXEC);
|
||||
m_wakeupWrite.setFlags(m_wakeupWrite.getFlags() | O_CLOEXEC);
|
||||
|
||||
runHyprlandThread(safeMode);
|
||||
|
||||
pollfd pollfds[2] = {
|
||||
|
||||
Reference in New Issue
Block a user