Sophie

Sophie

distrib > Mageia > 1 > i586 > by-pkgid > 03bdd856d84db3146de6a56ce373d107 > files > 15

dietlibc-0.32-4.20090113.6.mga1.src.rpm

From ab91f175a8c77f275c9fa917dfe7cbc9b6262e1c Mon Sep 17 00:00:00 2001
From: Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Date: Sat, 19 Apr 2008 17:49:05 +0200
Subject: [PATCH] Return new nice value for nice(2)

Changed nice(2) to return the new nice value instead of 0/-1.
---
 lib/__nice.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/__nice.c b/lib/__nice.c
index d751104..8e205c0 100644
--- a/lib/__nice.c
+++ b/lib/__nice.c
@@ -1,9 +1,13 @@
 #include "syscalls.h"
-#include <sys/time.h>
+#include <errno.h>
 #include <sys/resource.h>
 
 #ifndef __NR_nice
 int nice(int i) {
-  return setpriority(PRIO_PROCESS,0,getpriority(PRIO_PROCESS,0)+i);
+  if (setpriority(PRIO_PROCESS,0,getpriority(PRIO_PROCESS,0)+i) == -1) {
+    errno=EPERM;
+    return -1;
+  }
+  return getpriority(PRIO_PROCESS,0);
 }
 #endif
-- 
1.5.4.5