diff --git a/glib/grand.c b/glib/grand.c index 040562869..4d6a0a621 100644 --- a/glib/grand.c +++ b/glib/grand.c @@ -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) {