[glib/wip/coverity-fixes] GRand: Check return value of fopen directly



commit ff7e154d90ab34ebc84994eea08a72ba0dba7cff
Author: Colin Walters <walters verbum org>
Date:   Thu Jun 21 15:44:16 2012 -0400

    GRand: Check return value of fopen directly

 glib/grand.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/glib/grand.c b/glib/grand.c
index 0405628..be301a4 100644
--- a/glib/grand.c
+++ b/glib/grand.c
@@ -216,11 +216,8 @@ g_rand_new (void)
       FILE* dev_urandom;
 
       do
-        {
-	  errno = 0;
-	  dev_urandom = fopen("/dev/urandom", "rb");
-	}
-      while G_UNLIKELY (errno == EINTR);
+	dev_urandom = fopen("/dev/urandom", "rb");
+      while G_UNLIKELY (dev_urandom == NULL && errno == EINTR);
 
       if (dev_urandom)
 	{



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]