}
version = Util_SafeCalloc(1, sizeof *version);
- version->hostinfoOSVersionString = Util_SafeStrndup(u.release,
+ version->hostinfoOSVersionString = Util_SafeStrndup(u.release,
sizeof u.release);
ASSERT(ARRAYSIZE(version->hostinfoOSVersion) >= 4);
/*
- * The first three numbers are separated by '.', if there is
+ * The first three numbers are separated by '.', if there is
* a fourth number, it's probably separated by '.' or '-',
* but it could be preceded by anything.
*/
{
char *lsbStart = lsbOutput;
+ ASSERT(lsbStart != NULL);
+
if (lsbStart[0] == '"') {
char *quoteEnd = strchr(++lsbStart, '"');
/* LSB Distributor */
lsbOutput = HostinfoGetCmdOutput("/usr/bin/lsb_release -si 2>/dev/null");
- (*args)[0] = Util_SafeStrdup(HostinfoLsbRemoveQuotes(lsbOutput));
- free(lsbOutput);
+ if (lsbOutput != NULL) {
+ (*args)[0] = Util_SafeStrdup(HostinfoLsbRemoveQuotes(lsbOutput));
+ free(lsbOutput);
+ }
/* LSB Release */
lsbOutput = HostinfoGetCmdOutput("/usr/bin/lsb_release -sr 2>/dev/null");
- (*args)[1] = Util_SafeStrdup(HostinfoLsbRemoveQuotes(lsbOutput));
- free(lsbOutput);
+ if (lsbOutput != NULL) {
+ (*args)[1] = Util_SafeStrdup(HostinfoLsbRemoveQuotes(lsbOutput));
+ free(lsbOutput);
+ }
/* LSB Description */
(*args)[3] = Util_SafeStrdup((*args)[fields]);
*----------------------------------------------------------------------
*/
-static Bool
+static Bool
HostinfoFindEntry(char *buffer, // IN: Buffer
char *string, // IN: String sought
unsigned int *value) // OUT: Value
* HostinfoSysinfo --
*
* Retrieve system information on a Linux system.
- *
+ *
* Results:
* TRUE on success: '*totalRam', '*freeRam', '*totalSwap' and '*freeSwap'
* are set if not NULL
if (sysinfo((struct sysinfo *)&si) < 0) {
return FALSE;
}
-
+
if (si.mem_unit == 0) {
/*
* Kernel versions < 2.3.23. Those kernels used a smaller sysinfo
unsigned int *maxSize, // OUT:
unsigned int *currentSize) // OUT:
{
- uint64 total;
+ uint64 total;
uint64 free;
unsigned int cached = 0;
-
+
/*
* Note that the free memory provided by linux does not include buffer and
* cache memory. Linux tries to use the free memory to cache file. Most of
Hostinfo_GetSwapInfoInPages(unsigned int *totalSwap, // OUT:
unsigned int *freeSwap) // OUT:
{
- uint64 total;
+ uint64 total;
uint64 free;
if (HostinfoSysinfo(NULL, NULL, &total, &free) == FALSE) {
*maxSize = memsize / PAGE_SIZE;
return TRUE;
#elif defined(VMX86_SERVER)
- uint64 total;
+ uint64 total;
uint64 free;
VMK_ReturnStatus status;