Commit a0bb42d0 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Minor stylistic tweaks to the use of read_random_bytes.

parent 5c8b413f
......@@ -112,8 +112,12 @@ main(int argc, char **argv)
gettime(&now);
if (read_random_bytes(&seed, sizeof(seed)) == -1)
perror("read_random_bytes(seed, sizeof(seed))");
rc = read_random_bytes(&seed, sizeof(seed));
if(rc < 0) {
perror("read(random)");
seed = 42;
}
seed ^= (now.tv_sec ^ now.tv_usec);
srandom(seed);
......@@ -384,7 +388,9 @@ main(int argc, char **argv)
fprintf(stderr,
"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)");
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