/* If empty use default to 127.0.0.1 */
if (nameserver.empty())
{
- ServerInstance->Logs->Log("CONFIG",DEFAULT,"/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!");
+ ServerInstance->Logs->Log("CONFIG",DEFAULT,"No viable nameserver found in registry! Defaulting to nameserver '127.0.0.1'!");
server = "127.0.0.1";
return;
}
ServerInstance->Logs->Log("CONFIG",DEFAULT,"<dns:server> set to '%s' as first active resolver in registry.", nameserver.c_str());
}
-int gettimeofday(struct timeval * tv, void * tz)
+int clock_gettime(int clock, struct timespec * tv)
{
if(tv == NULL)
return -1;
DWORD mstime = timeGetTime();
tv->tv_sec = time(NULL);
- tv->tv_usec = (mstime - (tv->tv_sec * 1000)) * 1000;
+ tv->tv_usec = (mstime - (tv->tv_sec * 1000)) * 1000000;
return 0;
}
while (pEnumerator)
{
VARIANT vtProp;
+ VariantInit(&vtProp);
/* Next item */
HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
if (!FAILED(hr))
{
/* Matches our process ID? */
- if (vtProp.uintVal == GetCurrentProcessId())
- {
- VariantClear(&vtProp);
+ UINT pid = vtProp.uintVal;
+ VariantClear(&vtProp);
+ if (pid == GetCurrentProcessId())
+ {
/* Get CPU percentage for this process */
hr = pclsObj->Get(L"PercentProcessorTime", 0, &vtProp, 0, 0);
if (!FAILED(hr))
/* Deal with wide string ickyness. Who in their right
* mind puts a number in a bstrVal wide string item?!
*/
- VariantClear(&vtProp);
cpu = 0;
std::wstringstream out(vtProp.bstrVal);
out >> cpu;
- break;
+ VariantClear(&vtProp);
}
+ pclsObj->Release();
+ break;
}
+ pclsObj->Release();
}
}
pEnumerator->Release();
- pclsObj->Release();
}
SysFreeString(Language);