From b8b28a720660796bdc5b9734df7524555a655f3b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 26 Apr 2006 04:19:48 +0000 Subject: [PATCH] Don't repeat a failed fclose() call, since that invokes undefined 2006-04-26 Matthias Clasen * glib/grand.c (g_rand_new): Don't repeat a failed fclose() call, since that invokes undefined behaviour. (Coverity) --- ChangeLog | 5 +++++ ChangeLog.pre-2-12 | 5 +++++ glib/grand.c | 7 +------ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 052ba35..c8955ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-04-26 Matthias Clasen + + * glib/grand.c (g_rand_new): Don't repeat a failed fclose() + call, since that invokes undefined behaviour. (Coverity) + 2006-04-25 Matthias Clasen * glib/gbookmarkfile.c (is_element_full): Avoid a possible diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 052ba35..c8955ba 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +2006-04-26 Matthias Clasen + + * glib/grand.c (g_rand_new): Don't repeat a failed fclose() + call, since that invokes undefined behaviour. (Coverity) + 2006-04-25 Matthias Clasen * glib/gbookmarkfile.c (is_element_full): Avoid a possible diff --git a/glib/grand.c b/glib/grand.c index b1f809e..68274f9 100644 --- a/glib/grand.c +++ b/glib/grand.c @@ -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; -- 2.7.4