mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-11-03 01:42:18 +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;
|
||||
r = fread (seed, sizeof (seed), 1, dev_urandom);
|
||||
}
|
||||
while G_UNLIKELY (errno == EINTR);
|
||||
while G_UNLIKELY (r != 1 && errno == EINTR);
|
||||
|
||||
if (r != 1)
|
||||
dev_urandom_exists = FALSE;
|
||||
|
||||
Reference in New Issue
Block a user