]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: make setpriority clamp nice values to 0..2*NZERO-1 [BZ #33614]
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 9 Nov 2025 10:32:42 +0000 (11:32 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 9 Nov 2025 10:43:35 +0000 (11:43 +0100)
sysdeps/mach/hurd/setpriority.c

index f1ef46ca267a89633d0fffe78e62744f5eb5296c..aff201445720945c5bd01bd30ace22f700249dc7 100644 (file)
@@ -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;