Given that ERRNO_IS_PRIVILEGE() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.
In this case the arguments passed to ERRNO_IS_PRIVILEGE() are the values
returned by procfs_get_pid_max() and procfs_get_threads_max() which are
not expected to return any positive values, but let's be consistent
anyway and move ERRNO_IS_PRIVILEGE() invocations to the branches where
the return values are known to be negative.
pid_max = TASKS_MAX;
r = procfs_get_pid_max(&pid_max);
- if (r == -ENOENT || ERRNO_IS_PRIVILEGE(r))
+ if (r == -ENOENT || (r < 0 && ERRNO_IS_PRIVILEGE(r)))
return log_tests_skipped_errno(r, "can't get pid max");
assert(r >= 0);
log_info("kernel.pid_max: %"PRIu64, pid_max);
threads_max = TASKS_MAX;
r = procfs_get_threads_max(&threads_max);
- if (r == -ENOENT || ERRNO_IS_PRIVILEGE(r))
+ if (r == -ENOENT || (r < 0 && ERRNO_IS_PRIVILEGE(r)))
return log_tests_skipped_errno(r, "can't get threads max");
assert(r >= 0);
log_info("kernel.threads-max: %"PRIu64, threads_max);