Merge pull request #1520 from martin-frbg/cpucounts

Catch invalid cpu count returned by CPU_COUNT_S
This commit is contained in:
Martin Kroeker 2018-04-14 22:24:34 +02:00 committed by GitHub
commit f29389c7ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -212,7 +212,8 @@ int ret;
size = CPU_ALLOC_SIZE(nums);
ret = sched_getaffinity(0,size,cpusetp);
if (ret!=0) return nums;
nums = CPU_COUNT_S(size,cpusetp);
ret = CPU_COUNT_S(size,cpusetp);
if (ret > 0 && ret < nums) nums = ret;
CPU_FREE(cpusetp);
return nums;
#endif