OSDN Git Service

GRand: Check return value of fopen directly
authorColin Walters <walters@verbum.org>
Thu, 21 Jun 2012 19:44:16 +0000 (15:44 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 14 Jul 2012 20:33:15 +0000 (16:33 -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)
        {