check the return value of fscanf (#2218)

Signed-off-by: e <ych05zh@163.com>
This commit is contained in:
jackyu2020 2020-05-03 09:49:57 +08:00 committed by GitHub
parent ed2ee8873b
commit 86510aa295
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -318,8 +318,9 @@ SystemInfo::CPUTemperature() {
return result;
}
float temp;
fscanf(file, "%f", &temp);
result.push_back(temp / 1000);
if (fscanf(file, "%f", &temp) != -1) {
result.push_back(temp / 1000);
}
}
}
}