commit 795ffe490d24a6e85b7717f9ad6ec7b29469500e
Author: sin <s...@2f30.org>
Date:   Thu Feb 27 14:19:36 2014 +0000

    Use the more portable NZERO instead of PRIO_*
    
    We assume the valid range is [-NZERO, NZERO-1].

diff --git a/nice.c b/nice.c
index 0ef6256..f58a23b 100644
--- a/nice.c
+++ b/nice.c
@@ -32,7 +32,7 @@ main(int argc, char **argv)
        val += getpriority(PRIO_PROCESS, 0);
        if (errno != 0)
                weprintf("getpriority:");
-       val = MAX(PRIO_MIN, MIN(val, PRIO_MAX));
+       val = MAX(-NZERO, MIN(val, NZERO - 1));
        if (setpriority(PRIO_PROCESS, 0, val) != 0)
                weprintf("setpriority:");
 
diff --git a/renice.c b/renice.c
index a1ca2b9..f3eca5b 100644
--- a/renice.c
+++ b/renice.c
@@ -100,7 +100,7 @@ renice(int which, int who, long adj)
                return false;
        }
 
-       adj = MAX(PRIO_MIN, MIN(adj, PRIO_MAX));
+       adj = MAX(-NZERO, MIN(adj, NZERO - 1));
        if(setpriority(which, who, (int)adj) == -1) {
                fprintf(stderr, "can't set %d nice level: %s
",
                        who, strerror(errno));


Reply via email to