[glibc] hurd: make setpriority clamp nice values to 0..2*NZERO-1 [BZ #33614]
Samuel Thibault
sthibaul@sourceware.org
Sun Nov 9 10:44:27 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=494ba55d0b400a42adfc926d3d1f99973aee9cf1
commit 494ba55d0b400a42adfc926d3d1f99973aee9cf1
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Sun Nov 9 11:32:42 2025 +0100
hurd: make setpriority clamp nice values to 0..2*NZERO-1 [BZ #33614]
Diff:
---
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;
More information about the Glibc-cvs
mailing list