[glib] GRand: Check return value of fopen directly



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

    GRand: Check return value of fopen directly
    
    This doesn't fix anything, it should just silence some static analysis
    tools.

 glib/grand.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/glib/grand.c b/glib/grand.c
index 0405628..4d6a0a6 100644
--- a/glib/grand.c
+++ b/glib/grand.c
@@ -216,11 +216,10 @@ g_rand_new (void)
       FILE* dev_urandom;
 
       do
-        {
-	  errno = 0;
+	{
 	  dev_urandom = fopen("/dev/urandom", "rb");
 	}
-      while G_UNLIKELY (errno == EINTR);
+      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]