about summary refs log tree commit diff
path: root/sysdeps/posix/nice.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/posix/nice.c')
-rw-r--r--sysdeps/posix/nice.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sysdeps/posix/nice.c b/sysdeps/posix/nice.c
index 42bb99b7e1..8f6daaffbf 100644
--- a/sysdeps/posix/nice.c
+++ b/sysdeps/posix/nice.c
@@ -36,16 +36,16 @@ nice (int incr)
     {
       if (errno != 0)
 	return -1;
-      else
-	__set_errno (save);
     }
 
   result = __setpriority (PRIO_PROCESS, 0, prio + incr);
   if (result == -1)
     {
       if (errno == EACCES)
-	errno = EPERM;
+	__set_errno (EPERM);
       return -1;
     }
+
+  __set_errno (save);
   return __getpriority (PRIO_PROCESS, 0);
 }