[hackers] [sbase] Make sbase compile with musl || sin

From: <git_AT_suckless.org>
Date: Sat, 05 Oct 2013 16:29:29 +0200

commit 5d356561930624c293eb2240361b9f133a6bd70d
Author: sin <sin_AT_2f30.org>
Date: Mon Aug 19 16:32:23 2013 +0100

    Make sbase compile with musl

diff --git a/renice.c b/renice.c
index 1df512a..04cb960 100644
--- a/renice.c
+++ b/renice.c
_AT_@ -1,4 +1,5 @@
 /* See LICENSE file for copyright and license details. */
+#include <sys/resource.h>
 #include <errno.h>
 #include <limits.h>
 #include <pwd.h>
_AT_@ -6,7 +7,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/resource.h>
 #include "util.h"
 
 static int strtop(const char *);
_AT_@ -100,7 +100,8 @@ renice(int which, int who, long adj)
                 return false;
         }
 
- adj = MAX(PRIO_MIN, MIN(adj, PRIO_MAX));
+ /* PRIO_{MIN,MAX} does not exist in musl libc */
+ adj = MAX(-20, MIN(adj, 20));
         if(setpriority(which, who, (int)adj) == -1) {
                 fprintf(stderr, "can't set %d nice level: %s
",
                         who, strerror(errno));
Received on Sat Oct 05 2013 - 16:29:29 CEST

This archive was generated by hypermail 2.3.0 : Sat Oct 05 2013 - 16:36:34 CEST