]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
chrt: report actual PID in error message when 0 is specified
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Tue, 21 Apr 2026 15:35:25 +0000 (11:35 -0400)
committerChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Fri, 8 May 2026 18:02:44 +0000 (14:02 -0400)
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
schedutils/chrt.c

index 3e4ea41d51b17bb5ab461a774339f059d75f5970..7d920deeaee2b8af8cfc809221dbf4e1ed0dd804 100644 (file)
@@ -402,7 +402,7 @@ static void set_sched(struct chrt_ctl *ctl)
                err(EXIT_FAILURE, _("cannot obtain the list of tasks"));
 #endif
        } else if (set_sched_one(ctl, ctl->pid) == -1)
-               err(EXIT_FAILURE, _("failed to set pid %d's policy"), ctl->pid);
+               err(EXIT_FAILURE, _("failed to set pid %d's policy"), ctl->pid ? ctl->pid : getpid());
 
        ctl->altered = 1;
 }