]> git.ipfire.org Git - thirdparty/util-linux.git/commit
chrt: do not try to interpret any other option as a PID either
authorBenno Schulenberg <bensberg@telfort.nl>
Thu, 3 Jul 2025 14:47:52 +0000 (16:47 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 7 Jul 2025 11:33:11 +0000 (13:33 +0200)
commit73aa64cc8f4e3cda62950a937bf531e54bdc7f06
treec6e58b5fa5928fa1b7a378109e4ce823a26675f9
parent7f47aa34942e4f2ba06cf142f2f9aa39ba2ba4c3
chrt: do not try to interpret any other option as a PID either

When doing, for example, `chrt --pid --max`, it would report:

  chrt: invalid PID argument: '--max'

This mistakenly gave the impression that the PID argument has to follow
directly after the --pid option.

Avoid this by delaying the parsing of a PID until after all options have
been parsed.  Temporarily set 'ctl->pid' to zero to indicate that a PID
needs to be read.

After this change, `chrt --pid --max` will simply report the minimum and
maximum valid priorities.  And `chrt --pid -v`:

  chrt: too few arguments

Also, add a missing call of gettext() for the other error message.

CC: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
schedutils/chrt.c