summaryrefslogtreecommitdiff
path: root/utils/start-stop-daemon.c
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2016-08-23 21:39:24 +0200
committerGuillem Jover <guillem@debian.org>2016-10-30 04:45:33 +0100
commit37af4e517e8fdf925638ddc57138a89ff0b8e8dd (patch)
treecbc2390fcde9525bde6cadd56996f3c0823523e6 /utils/start-stop-daemon.c
parent454721714d100209ace5e8151bf9f9019de43ed6 (diff)
downloaddpkg-37af4e517e8fdf925638ddc57138a89ff0b8e8dd.tar.gz
s-s-d: Handle _POSIX_PRIORITY_SCHEDULING being defined to -1 or 0
POSIX states that these can be defined as -1 (unavailable), or 0 (available at build-time, but might or might not be available at run-time). Handles these, which happens to be the case in Mac OS X.
Diffstat (limited to 'utils/start-stop-daemon.c')
-rw-r--r--utils/start-stop-daemon.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index 7152d1044..4245e45aa 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -112,7 +112,7 @@
#endif
#endif
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && _POSIX_PRIORITY_SCHEDULING > 0
#include <sched.h>
#else
#define SCHED_OTHER -1
@@ -731,7 +731,7 @@ parse_umask(const char *string, int *value_r)
static void
validate_proc_schedule(void)
{
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && _POSIX_PRIORITY_SCHEDULING > 0
int prio_min, prio_max;
prio_min = sched_get_priority_min(proc_sched->policy);
@@ -814,7 +814,7 @@ parse_io_schedule(const char *string)
static void
set_proc_schedule(struct res_schedule *sched)
{
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && _POSIX_PRIORITY_SCHEDULING > 0
struct sched_param param;
param.sched_priority = sched->priority;