diff options
author | Henrik Nord <[email protected]> | 2012-02-14 11:06:53 +0100 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2012-02-14 11:06:53 +0100 |
commit | f44819b6caa42697cbf2b6b52f95f7b87baf683f (patch) | |
tree | 80004096708f644c87ef29e82f4ca1ed5fb38a2f /lib/os_mon | |
parent | b0be4ac9eb763b2d1f31712ff33346fb968ba582 (diff) | |
parent | 8425d4b6b26a9eea2c707fc343776fc404c0fbad (diff) | |
download | otp-f44819b6caa42697cbf2b6b52f95f7b87baf683f.tar.gz otp-f44819b6caa42697cbf2b6b52f95f7b87baf683f.tar.bz2 otp-f44819b6caa42697cbf2b6b52f95f7b87baf683f.zip |
Merge branch 'maint'
Diffstat (limited to 'lib/os_mon')
-rw-r--r-- | lib/os_mon/c_src/memsup.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/os_mon/c_src/memsup.c b/lib/os_mon/c_src/memsup.c index 241e7718db..b6e417eaa0 100644 --- a/lib/os_mon/c_src/memsup.c +++ b/lib/os_mon/c_src/memsup.c @@ -327,27 +327,27 @@ get_mem_procfs(memory_ext *me){ /* Total and free is NEEDED! */ bp = strstr(buffer, "MemTotal:"); - if (sscanf(bp, "MemTotal: %lu kB\n", &(me->total))) me->flag |= F_MEM_TOTAL; + if (bp != NULL && sscanf(bp, "MemTotal: %lu kB\n", &(me->total))) me->flag |= F_MEM_TOTAL; bp = strstr(buffer, "MemFree:"); - if (sscanf(bp, "MemFree: %lu kB\n", &(me->free))) me->flag |= F_MEM_FREE; + if (bp != NULL && sscanf(bp, "MemFree: %lu kB\n", &(me->free))) me->flag |= F_MEM_FREE; /* Extensions */ bp = strstr(buffer, "Buffers:"); - if (sscanf(bp, "Buffers: %lu kB\n", &(me->buffered))) me->flag |= F_MEM_BUFFERS; + if (bp != NULL && sscanf(bp, "Buffers: %lu kB\n", &(me->buffered))) me->flag |= F_MEM_BUFFERS; bp = strstr(buffer, "Cached:"); - if (sscanf(bp, "Cached: %lu kB\n", &(me->cached))) me->flag |= F_MEM_CACHED; + if (bp != NULL && sscanf(bp, "Cached: %lu kB\n", &(me->cached))) me->flag |= F_MEM_CACHED; /* Swap */ bp = strstr(buffer, "SwapTotal:"); - if (sscanf(bp, "SwapTotal: %lu kB\n", &(me->total_swap))) me->flag |= F_SWAP_TOTAL; + if (bp != NULL && sscanf(bp, "SwapTotal: %lu kB\n", &(me->total_swap))) me->flag |= F_SWAP_TOTAL; bp = strstr(buffer, "SwapFree:"); - if (sscanf(bp, "SwapFree: %lu kB\n", &(me->free_swap))) me->flag |= F_SWAP_FREE; + if (bp != NULL && sscanf(bp, "SwapFree: %lu kB\n", &(me->free_swap))) me->flag |= F_SWAP_FREE; me->pagesize = 1024; /* procfs defines its size in kB */ |