]> git.ipfire.org Git - thirdparty/util-linux.git/commit
chcpu: fix persistent partial success exit code
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Mon, 1 Jun 2026 21:53:28 +0000 (17:53 -0400)
committerChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Wed, 24 Jun 2026 23:51:48 +0000 (19:51 -0400)
commit89fa13125b02247a489de484e7d6d67b006f7a2a
tree886036e3dec83706fa55145bf23acc14a5fe9bb3
parent41b9ebaf0ddbec937423a4204485e6e3988c5263
chcpu: fix persistent partial success exit code

Previously, cpu_enable() and cpu_configure() compared the number
of fails with ctx->maxcpus and if equal it returned -1, which
culminated over to an exit code of 1 (failure). Otherwise, if
there were fails but less than ctx->maxcpus the fucntions return
code 1 would result in an exit code 64 indicating partial success.

Since ctx->maxcpus describes the maximum number of CPUs supported
by the kernel, in practice, this failure mode isn't really useful
as it means that a user would need to fail the configuration of
every possible CPU. This is why chcpu(8) almost always returns 64.

It is better to store the actual amount of requested CPUs and then
compare the amount of fails to it and provide more meaningful exit
codes.

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
sys-utils/chcpu.c