Browse Source

Fixed warning

pull/996/head
Luca Deri 2 years ago
parent
commit
23e168b955
  1. 3
      src/random_numbers.c

3
src/random_numbers.c

@ -98,10 +98,11 @@ uint64_t n2n_seed (void) {
uint64_t seed = 0; /* this could even go uninitialized */ uint64_t seed = 0; /* this could even go uninitialized */
uint64_t ret = 0; /* this could even go uninitialized */ uint64_t ret = 0; /* this could even go uninitialized */
size_t i = 0;
#ifdef SYS_getrandom #ifdef SYS_getrandom
size_t i = 0;
int rc = -1; int rc = -1;
for(i = 0; (i < RND_RETRIES) && (rc != sizeof(seed)); i++) { for(i = 0; (i < RND_RETRIES) && (rc != sizeof(seed)); i++) {
rc = syscall (SYS_getrandom, &seed, sizeof(seed), GRND_NONBLOCK); rc = syscall (SYS_getrandom, &seed, sizeof(seed), GRND_NONBLOCK);
// if successful, rc should contain the requested number of random bytes // if successful, rc should contain the requested number of random bytes

Loading…
Cancel
Save