Don't repeat a failed fclose() call, since that invokes undefined
authorMatthias Clasen <mclasen@redhat.com>
Wed, 26 Apr 2006 04:19:48 +0000 (04:19 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 26 Apr 2006 04:19:48 +0000 (04:19 +0000)
2006-04-26  Matthias Clasen  <mclasen@redhat.com>

* glib/grand.c (g_rand_new): Don't repeat a failed fclose()
call, since that invokes undefined behaviour.  (Coverity)

ChangeLog
ChangeLog.pre-2-12
glib/grand.c

index 052ba35..c8955ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-04-26  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/grand.c (g_rand_new): Don't repeat a failed fclose()
+       call, since that invokes undefined behaviour.  (Coverity)
+
 2006-04-25  Matthias Clasen  <mclasen@redhat.com>
 
        * glib/gbookmarkfile.c (is_element_full): Avoid a possible
index 052ba35..c8955ba 100644 (file)
@@ -1,3 +1,8 @@
+2006-04-26  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/grand.c (g_rand_new): Don't repeat a failed fclose()
+       call, since that invokes undefined behaviour.  (Coverity)
+
 2006-04-25  Matthias Clasen  <mclasen@redhat.com>
 
        * glib/gbookmarkfile.c (is_element_full): Avoid a possible
index b1f809e..68274f9 100644 (file)
@@ -191,12 +191,7 @@ g_rand_new (void)
          if (r != 1)
            dev_urandom_exists = FALSE;
 
-         do
-           {
-             errno = 0;
-             fclose (dev_urandom);
-           }
-         while G_UNLIKELY (errno == EINTR);
+         fclose (dev_urandom);
        }       
       else
        dev_urandom_exists = FALSE;