Fix invalid strcmp length perfs parser
This commit is contained in:
parent
de3e842425
commit
d3f28ab24c
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#ifndef __MINGW32__
|
#ifndef __MINGW32__
|
||||||
static int parseLine(char* line) {
|
static int parseLine(char* line) {
|
||||||
// This assumes that a digit will be found and the line ends in " Kb".
|
// This assumes that a digit will be found and the line ends in "kB".
|
||||||
int i = strlen(line);
|
int i = strlen(line);
|
||||||
const char* p = line;
|
const char* p = line;
|
||||||
while (*p <'0' || *p > '9') p++;
|
while (*p <'0' || *p > '9') p++;
|
||||||
@ -43,7 +43,7 @@ static int getLinuxPhysicalMemUsage() {
|
|||||||
char line[128];
|
char line[128];
|
||||||
|
|
||||||
while (fgets(line, 128, file) != NULL){
|
while (fgets(line, 128, file) != NULL){
|
||||||
if (strncmp(line, "VmRSS:", 7) == 0){
|
if (strncmp(line, "VmRSS:", 6) == 0){
|
||||||
result = parseLine(line);
|
result = parseLine(line);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user