Blame 0017-PATCH-1-of-1-correctly-check-return-value-of-nice.patch

c2d5d21
From 8d3e9e5c3e1813b372f84d3bcca08bbe479f7f63 Mon Sep 17 00:00:00 2001
c2d5d21
From: Lee Duncan <leeman.duncan@gmail.com>
c2d5d21
Date: Tue, 21 May 2013 14:16:38 -0700
c2d5d21
Subject: PATCH 1 of 1] correctly check return value of nice()
c2d5d21
c2d5d21
The nice() call can return a negative value, since
c2d5d21
it returns the previous nice value.
c2d5d21
c2d5d21
Signed-off-by: Lee Duncan <leeman.duncan@gmail.com>
c2d5d21
---
c2d5d21
 usr/iscsi_util.c | 3 ++-
c2d5d21
 1 file changed, 2 insertions(+), 1 deletion(-)
c2d5d21
c2d5d21
diff --git a/usr/iscsi_util.c b/usr/iscsi_util.c
c2d5d21
index 5e3420e..ac86847 100644
c2d5d21
--- a/usr/iscsi_util.c
c2d5d21
+++ b/usr/iscsi_util.c
c2d5d21
@@ -60,7 +60,8 @@ int oom_adjust(void)
c2d5d21
 	char path[ISCSI_OOM_PATH_LEN];
c2d5d21
 	struct stat statb;
c2d5d21
 
c2d5d21
-	if (nice(-10) < 0)
c2d5d21
+	errno = 0;
c2d5d21
+	if (nice(-10) == -1 && errno != 0)
c2d5d21
 		log_debug(1, "Could not increase process priority: %s",
c2d5d21
 			  strerror(errno));
c2d5d21
 
c2d5d21
-- 
c2d5d21
1.8.1.4
c2d5d21