mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-11-06 19:13:19 +01:00
grand: Avoid reading an undefined value from errno
The value of `errno` can apparently be undefined after a successful function call (according to scan-build), so only check `errno` on failure. Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
@@ -194,7 +194,7 @@ g_rand_new (void)
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
r = fread (seed, sizeof (seed), 1, dev_urandom);
|
r = fread (seed, sizeof (seed), 1, dev_urandom);
|
||||||
}
|
}
|
||||||
while G_UNLIKELY (errno == EINTR);
|
while G_UNLIKELY (r != 1 && errno == EINTR);
|
||||||
|
|
||||||
if (r != 1)
|
if (r != 1)
|
||||||
dev_urandom_exists = FALSE;
|
dev_urandom_exists = FALSE;
|
||||||
|
|||||||
Reference in New Issue
Block a user