]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
chrt: produce better error message for missing priority with implied -r
authorBenno Schulenberg <bensberg@telfort.nl>
Tue, 5 Aug 2025 09:24:40 +0000 (11:24 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 7 Aug 2025 09:20:35 +0000 (11:20 +0200)
Since commit 4c425142844d, the following two equivalent commands produce
different error messages:

  # chrt -r ls NEWS
  chrt: invalid priority argument: 'ls'
  # chrt ls NEWS
  chrt: unsupported priority value for the policy: 0: see --max for valid range

The latter error message is enigmatic: where did the user specify '0'?

Before the mentioned commit, the second command would produce the same
error message as the first.  Restore that behavior.

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

index 1a9522728abd7cf8c0ef1a48c9e2b82725bad56c..e07284e4181d1cc5e51957d2f3154257974e3b24 100644 (file)
@@ -524,6 +524,9 @@ int main(int argc, char **argv)
                }
        }
 
+       if (ctl->policy == SCHED_RR)
+               need_prio = true;
+
        if (ctl->verbose)
                show_sched_info(ctl);