Fix --cpu-affinity overflow.
This commit is contained in:
parent
faf793b0aa
commit
f36b5eeaad
1 changed files with 1 additions and 7 deletions
|
@ -231,7 +231,6 @@ bool Options::parseArg(int key, char *arg)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
int v;
|
int v;
|
||||||
uint64_t ul;
|
|
||||||
Url *url;
|
Url *url;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -357,12 +356,7 @@ bool Options::parseArg(int key, char *arg)
|
||||||
|
|
||||||
case 1020: /* --cpu-affinity */
|
case 1020: /* --cpu-affinity */
|
||||||
p = strstr(arg, "0x");
|
p = strstr(arg, "0x");
|
||||||
ul = p ? strtoul(p, NULL, 16) : atol(arg);
|
m_affinity = p ? strtoull(p, nullptr, 16) : strtoull(arg, nullptr, 10);
|
||||||
if (ul > (1UL << Cpu::threads()) -1) {
|
|
||||||
ul = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_affinity = ul;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1002: /* --no-color */
|
case 1002: /* --no-color */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue