summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2012-06-21 15:44:16 -0400
committerColin Walters <walters@verbum.org>2012-06-21 15:44:16 -0400
commitff7e154d90ab34ebc84994eea08a72ba0dba7cff (patch)
treec39717311497ead80cbb8cc47740b8bac354c3c4
parent1ef344968c5e0ead929fc928891c28e7a8dbb74f (diff)
downloadglib-wip/coverity-fixes.tar.gz
GRand: Check return value of fopen directlywip/coverity-fixes
-rw-r--r--glib/grand.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/glib/grand.c b/glib/grand.c
index 040562869..be301a4ed 100644
--- a/glib/grand.c
+++ b/glib/grand.c
@@ -216,11 +216,8 @@ g_rand_new (void)
FILE* dev_urandom;
do
- {
- errno = 0;
- dev_urandom = fopen("/dev/urandom", "rb");
- }
- while G_UNLIKELY (errno == EINTR);
+ dev_urandom = fopen("/dev/urandom", "rb");
+ while G_UNLIKELY (dev_urandom == NULL && errno == EINTR);
if (dev_urandom)
{