From cac0a5c651535e8317839b0deff1ee98086a8184 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sat, 20 Nov 2010 14:31:11 +0000 Subject: [PATCH] Use setpriority() instead of nice() on UNIX-like systems. The return value of nice() can not reliably indicate errors. The return value of the setpriority() call is well-defined. --- src/tincd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tincd.c b/src/tincd.c index 3dab9a01..77581511 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -502,12 +502,12 @@ static bool drop_privs() { } #ifdef HAVE_MINGW -# define setpriority(level) SetPriorityClass(GetCurrentProcess(), level) +# define setpriority(level) SetPriorityClass(GetCurrentProcess(), (level)) #else # define NORMAL_PRIORITY_CLASS 0 # define BELOW_NORMAL_PRIORITY_CLASS 10 # define HIGH_PRIORITY_CLASS -10 -# define setpriority(level) nice(level) +# define setpriority(level) (setpriority(PRIO_PROCESS, 0, (level))) #endif int main(int argc, char **argv) { -- 2.20.1