diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-04-25 17:01:06 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-04-25 17:01:06 +0000 |
commit | 44f08212597f46caee40d2176feefcbb43653e16 (patch) | |
tree | af6da9d86508162f30fc8bc14010f438ac87b71f | |
parent | 95842fbc163d935cc5f7dc67dd49bbe906c2eae4 (diff) | |
download | busybox-44f08212597f46caee40d2176feefcbb43653e16.tar.gz |
taskset: (1ull < 65) like ops are not good, avoid that
-rw-r--r-- | miscutils/taskset.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/miscutils/taskset.c b/miscutils/taskset.c index 4815b6a76..708abd9f2 100644 --- a/miscutils/taskset.c +++ b/miscutils/taskset.c @@ -93,8 +93,10 @@ int taskset_main(int argc ATTRIBUTE_UNUSED, char **argv) unsigned i; /* Do not allow zero mask: */ unsigned long long m = xstrtoull_range(aff, 0, 1, ULLONG_MAX); + enum { CNT_BIT = CPU_SETSIZE < sizeof(m)*8 ? CPU_SETSIZE : sizeof(m)*8 }; + CPU_ZERO(&mask); - for (i = 0; i < CPU_SETSIZE; i++) { + for (i = 0; i < CNT_BIT; i++) { unsigned long long bit = (1ULL << i); if (bit & m) CPU_SET(i, &mask); |