btrfs-progs: image: fix bogus check after cpu on-line detection
Comparing unsigned type for <= 0 does not make much sense, we should really check the signed value returned by sysconf. Resolves-coverity-id: 1324536 Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c9bddcacbc
commit
4f42e465cb
|
@ -2787,9 +2787,11 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (compress_level > 0 || create == 0) {
|
||||
if (num_threads == 0) {
|
||||
num_threads = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
if (num_threads <= 0)
|
||||
num_threads = 1;
|
||||
long tmp = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
|
||||
if (tmp <= 0)
|
||||
tmp = 1;
|
||||
num_threads = tmp;
|
||||
}
|
||||
} else {
|
||||
num_threads = 0;
|
||||
|
|
Loading…
Reference in New Issue