chore: Clean up shutdownExistingProcesses (unused var and use if-init) in Windows watchdog

This commit is contained in:
Nick Bolton 2025-03-03 11:38:54 +00:00
parent c84b4e3f00
commit cd5ba1382d

View file

@ -394,11 +394,9 @@ void MSWindowsWatchdog::shutdownExistingProcesses()
} }
// now just iterate until we can find winlogon.exe pid // now just iterate until we can find winlogon.exe pid
DWORD pid = 0;
while (gotEntry) { while (gotEntry) {
HANDLE handle = openProcessForKill(entry); if (HANDLE handle = openProcessForKill(entry); handle != nullptr) {
if (handle) {
LOG((CLOG_INFO "shutting down process, name=%s, pid=%d", entry.szExeFile, entry.th32ProcessID)); LOG((CLOG_INFO "shutting down process, name=%s, pid=%d", entry.szExeFile, entry.th32ProcessID));
deskflow::platform::MSWindowsProcess::shutdown(handle, entry.th32ProcessID); deskflow::platform::MSWindowsProcess::shutdown(handle, entry.th32ProcessID);
CloseHandle(handle); CloseHandle(handle);