Re: PATCH 1 of 1] correctly check return value of nice()

2013-05-28 Thread Mike Christie
On 05/21/2013 04:16 PM, Lee Duncan wrote:
 The nice() call can return a negative value, since
 it returns the previous nice value.
 
 Signed-off-by: Lee Duncan leeman.dun...@gmail.com
 ---
  usr/iscsi_util.c |3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/usr/iscsi_util.c b/usr/iscsi_util.c
 index 5e3420e..ac86847 100644
 --- a/usr/iscsi_util.c
 +++ b/usr/iscsi_util.c
 @@ -60,7 +60,8 @@ int oom_adjust(void)
   char path[ISCSI_OOM_PATH_LEN];
   struct stat statb;
  
 - if (nice(-10)  0)
 + errno = 0;
 + if (nice(-10) == -1  errno != 0)
   log_debug(1, Could not increase process priority: %s,
 strerror(errno));
  
 


Merged in commit fdac3904c36f2d0bf0a096d533e483ec3be004d2

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




PATCH 1 of 1] correctly check return value of nice()

2013-05-21 Thread Lee Duncan
The nice() call can return a negative value, since
it returns the previous nice value.

Signed-off-by: Lee Duncan leeman.dun...@gmail.com
---
 usr/iscsi_util.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/usr/iscsi_util.c b/usr/iscsi_util.c
index 5e3420e..ac86847 100644
--- a/usr/iscsi_util.c
+++ b/usr/iscsi_util.c
@@ -60,7 +60,8 @@ int oom_adjust(void)
char path[ISCSI_OOM_PATH_LEN];
struct stat statb;
 
-   if (nice(-10)  0)
+   errno = 0;
+   if (nice(-10) == -1  errno != 0)
log_debug(1, Could not increase process priority: %s,
  strerror(errno));
 
-- 
1.7.10.4

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.