GRand: Check return value of fopen directly
authorColin Walters <walters@verbum.org>
Thu, 21 Jun 2012 19:44:16 +0000 (15:44 -0400)
committerColin Walters <walters@verbum.org>
Fri, 22 Jun 2012 14:34:46 +0000 (10:34 -0400)
This doesn't fix anything, it should just silence some static analysis
tools.

glib/grand.c

index 0405628..4d6a0a6 100644 (file)
@@ -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)
        {