util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4 V2] chrt: with more than one argument, interpret first argument as priority
@ 2025-07-03 14:47 Benno Schulenberg
  2025-07-03 14:47 ` [PATCH 2/4 V2] chrt: do not try to interpret the --pid option itself as a PID Benno Schulenberg
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Benno Schulenberg @ 2025-07-03 14:47 UTC (permalink / raw)
  To: util-linux; +Cc: Madadi Vineeth Reddy

The first argument is a priority not only for `chrt --pid <prio> <pid>`
but also for `chrt <prio> <command> [<argument>...]`.

This fixes an oversight in recent commit e7a2d62434.

Reviewed-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Tested-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
---
 schedutils/chrt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index 550cefe4d..415a9aa77 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -530,7 +530,7 @@ int main(int argc, char **argv)
 
 	errno = 0;
 
-	if (need_prio || argc - optind == 2)
+	if (need_prio || argc - optind > 1)
 		ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument"));
 	else
 		ctl->priority = 0;
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2025-07-16  8:16 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03 14:47 [PATCH 1/4 V2] chrt: with more than one argument, interpret first argument as priority Benno Schulenberg
2025-07-03 14:47 ` [PATCH 2/4 V2] chrt: do not try to interpret the --pid option itself as a PID Benno Schulenberg
2025-07-03 14:47 ` [PATCH 3/4 V2] chrt: simplify the other check for too few arguments Benno Schulenberg
2025-07-06  5:58   ` Madadi Vineeth Reddy
2025-07-06  9:10     ` Benno Schulenberg
2025-07-09  7:12       ` chrt from git segfaults Benno Schulenberg
2025-07-09 18:45         ` Madadi Vineeth Reddy
2025-07-10  8:11           ` Benno Schulenberg
2025-07-12 16:29             ` Madadi Vineeth Reddy
2025-07-14 11:32             ` Karel Zak
2025-07-15  5:29               ` Madadi Vineeth Reddy
2025-07-15  9:19               ` Benno Schulenberg
2025-07-16  8:16                 ` Karel Zak
2025-07-03 14:47 ` [PATCH 4/4 V2] chrt: do not try to interpret any other option as a PID either Benno Schulenberg
2025-07-06  6:09   ` Madadi Vineeth Reddy
2025-07-14 11:28     ` Karel Zak
2025-07-15  5:33       ` Madadi Vineeth Reddy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).