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:
Philip Withnall
2025-10-16 23:56:43 +01:00
parent 0ab1866145
commit ca1e32f067

View File

@@ -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;