about summary refs log tree commit diff
path: root/sysdeps/posix/nice.c
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2015-08-11 23:40:00 -0700
committerPaul Pluzhnikov <ppluzhnikov@google.com>2015-08-11 23:40:00 -0700
commit84895dca70f972df3842fb88f7b33b5d695cc599 (patch)
treeade512ca77f27f09e58435878cec1c640dfaed88 /sysdeps/posix/nice.c
parent5011051da35a91577d262040791cbe5a868cffbd (diff)
downloadglibc-84895dca70f972df3842fb88f7b33b5d695cc599.tar.gz
glibc-84895dca70f972df3842fb88f7b33b5d695cc599.tar.xz
glibc-84895dca70f972df3842fb88f7b33b5d695cc599.zip
Fix BZ #18086 -- nice resets errno to 0.
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);
 }