Commit 99b98458 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Minor stylistic tweaks to the use of read_random_bytes.

parent 3a631dbb
...@@ -112,8 +112,12 @@ main(int argc, char **argv) ...@@ -112,8 +112,12 @@ main(int argc, char **argv)
gettime(&now); gettime(&now);
if (read_random_bytes(&seed, sizeof(seed)) == -1) rc = read_random_bytes(&seed, sizeof(seed));
perror("read_random_bytes(seed, sizeof(seed))"); if(rc < 0) {
perror("read(random)");
seed = 42;
}
seed ^= (now.tv_sec ^ now.tv_usec); seed ^= (now.tv_sec ^ now.tv_usec);
srandom(seed); srandom(seed);
...@@ -396,7 +400,9 @@ main(int argc, char **argv) ...@@ -396,7 +400,9 @@ main(int argc, char **argv)
fprintf(stderr, fprintf(stderr,
"Warning: couldn't find router id -- using random value.\n"); "Warning: couldn't find router id -- using random value.\n");
if(read_random_bytes(myid, 8) == -1) {
rc = read_random_bytes(myid, 8);
if(rc < 0) {
perror("read(random)"); perror("read(random)");
goto fail; goto fail;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment