summaryrefslogtreecommitdiffstats
path: root/lib/cpuset.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cpuset.c')
-rw-r--r--lib/cpuset.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/cpuset.c b/lib/cpuset.c
index 098b8e5..533b8ab 100644
--- a/lib/cpuset.c
+++ b/lib/cpuset.c
@@ -287,7 +287,7 @@ static int nextnumber(const char *str, char **end, unsigned int *result)
*/
int cpulist_parse(const char *str, cpu_set_t *set, size_t setsize, int fail)
{
- size_t max = cpuset_nbits(setsize);
+ const size_t max = cpuset_nbits(setsize);
const char *p, *q;
char *end = NULL;
@@ -326,8 +326,12 @@ int cpulist_parse(const char *str, cpu_set_t *set, size_t setsize, int fail)
if (!(a <= b))
return 1;
while (a <= b) {
- if (fail && (a >= max))
- return 2;
+ if (a >= max) {
+ if (fail)
+ return 2;
+ else
+ break;
+ }
CPU_SET_S(a, setsize, set);
a += s;
}