From 485122644456c22287659063a2cc89ceb7d88715 Mon Sep 17 00:00:00 2001 From: "xiuhong.wang" Date: Thu, 30 May 2024 10:13:19 +0800 Subject: [PATCH] Fix ionice's return value for getting process IO priority In the user version, if you use ionice to get the process IO priority without permission, -1 will be returned, but Idle: prio 7 will be printed at this time. This is an incorrect priority and should return permission denied. --- toys/other/ionice.c | 1 + 1 file changed, 1 insertion(+) diff --git a/toys/other/ionice.c b/toys/other/ionice.c index db3a6f41..12642537 100644 --- a/toys/other/ionice.c +++ b/toys/other/ionice.c @@ -60,6 +60,7 @@ void ionice_main(void) if (toys.optflags == FLAG_p) { int p = ioprio_get(); + if (p == -1) perror_exit("read priority"); xprintf("%s: prio %d\n", (char *[]){"unknown", "Realtime", "Best-effort", "Idle"}[(p>>13)&3], p&7); -- 2.39.2