]> granicus.if.org Git - icinga2/commitdiff
Remove redundant checks in check_procs
authorGunnar Beutner <gunnar@beutner.name>
Mon, 2 Mar 2015 12:22:37 +0000 (13:22 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Mon, 2 Mar 2015 12:22:37 +0000 (13:22 +0100)
plugins/check_procs.cpp

index c5904eca254d68d9ed67cbb931f9a52e57b8d71c..8747cb66c332b802ecd01e6a32d40cd7803294dd 100644 (file)
@@ -297,14 +297,8 @@ int countProcs(const wstring user)
                pSIDTokenUser = reinterpret_cast<PTOKEN_USER>(new BYTE[dwReturnLength]);
                memset(pSIDTokenUser, 0, dwReturnLength);
 
-               if (!pSIDTokenUser) {
-                       if (debug)
-                               wcout << L"Could not recieve token, skiping" << endl;
-                       continue;
-               }
-
                if (debug)
-                       wcout << L"Recieved token, saving information" << endl;
+                       wcout << L"Received token, saving information" << endl;
 
                //write Info in pSIDTokenUser
                if (!GetTokenInformation(hToken, TokenUser, pSIDTokenUser, dwReturnLength, NULL))
@@ -327,9 +321,6 @@ int countProcs(const wstring user)
                AcctName = reinterpret_cast<LPWSTR>(new WCHAR[dwAcctName]);
                DomainName = reinterpret_cast<LPWSTR>(new WCHAR[dwDomainName]);
 
-               if (!AcctName || !DomainName)
-                       continue;
-               
                if (!LookupAccountSid(NULL, pSIDTokenUser->User.Sid, AcctName,
                        (LPDWORD)&dwAcctName, DomainName, (LPDWORD)&dwDomainName, &sidNameUse))
                        continue;
@@ -346,7 +337,6 @@ int countProcs(const wstring user)
                delete[] reinterpret_cast<LPWSTR>(DomainName);
 
        } while (Process32Next(hProcessSnap, &pe32));
-       
 
 die:
        if (hProcessSnap)
@@ -358,4 +348,4 @@ die:
        if (pSIDTokenUser)
                delete[] reinterpret_cast<PTOKEN_USER>(pSIDTokenUser);
        return numProcs;
-}
\ No newline at end of file
+}