mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
fix: bounds check result in getMaxCPU
Fixes https://github.com/NixOS/nix/issues/9725
This commit is contained in:
parent
bdb6f56c90
commit
9c64a09c70
1 changed files with 5 additions and 0 deletions
|
@ -38,6 +38,11 @@ unsigned int getMaxCPU()
|
||||||
|
|
||||||
auto cpuMax = readFile(cpuFile);
|
auto cpuMax = readFile(cpuFile);
|
||||||
auto cpuMaxParts = tokenizeString<std::vector<std::string>>(cpuMax, " \n");
|
auto cpuMaxParts = tokenizeString<std::vector<std::string>>(cpuMax, " \n");
|
||||||
|
|
||||||
|
if (cpuMaxParts.size() != 2) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
auto quota = cpuMaxParts[0];
|
auto quota = cpuMaxParts[0];
|
||||||
auto period = cpuMaxParts[1];
|
auto period = cpuMaxParts[1];
|
||||||
if (quota != "max")
|
if (quota != "max")
|
||||||
|
|
Loading…
Reference in a new issue