[hurd, commited] hurd: make setpriority clamp nice values to 0..2*NZERO-1 [BZ #33614]
Samuel Thibault
samuel.thibault@ens-lyon.org
Sun Nov 9 10:44:33 GMT 2025
---
sysdeps/mach/hurd/setpriority.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sysdeps/mach/hurd/setpriority.c b/sysdeps/mach/hurd/setpriority.c
index f1ef46ca26..aff2014457 100644
--- a/sysdeps/mach/hurd/setpriority.c
+++ b/sysdeps/mach/hurd/setpriority.c
@@ -17,6 +17,7 @@
#include <hurd.h>
#include <hurd/resource.h>
+#include <sys/param.h>
/* Set the priority of all processes specified by WHICH and WHO
to PRIO. Returns 0 on success, -1 on errors. */
@@ -27,6 +28,8 @@ __setpriority (enum __priority_which which, id_t who, int prio)
error_t pidloser, priloser;
unsigned int npids, ntasks, nwin, nperm, nacces;
+ prio = MAX (0, MIN (2 * NZERO - 1, prio));
+
error_t setonepriority (pid_t pid, struct procinfo *pi)
{
task_t task;
--
2.51.0
More information about the Libc-alpha
mailing list