Skip to content

Commit

Permalink
Merge litecoin-project#499: tests: Make sure we get the requested num…
Browse files Browse the repository at this point in the history
…ber of bytes from /dev/urandom

82a96e4 tests: Make sure we get the requested number of bytes from /dev/urandom (practicalswift)

Pull request description:

  Make sure we get the requested number of bytes from `/dev/urandom`.

Tree-SHA512: 1b035942fd2a6ee2423fb2a2a0a0f294682c51434f86e5c106fb493d77f45aa8070662190aca6441fe389b8cdcc132d432517b8e826be2ac530a1511cd0c8919
  • Loading branch information
gmaxwell committed Feb 6, 2018
2 parents b549d3d + 82a96e4 commit f99aa8d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -4918,7 +4918,7 @@ int main(int argc, char **argv) {
}
} else {
FILE *frand = fopen("/dev/urandom", "r");
if ((frand == NULL) || !fread(&seed16, sizeof(seed16), 1, frand)) {
if ((frand == NULL) || fread(&seed16, sizeof(seed16), 1, frand) != sizeof(seed16)) {
uint64_t t = time(NULL) * (uint64_t)1337;
seed16[0] ^= t;
seed16[1] ^= t >> 8;
Expand Down

0 comments on commit f99aa8d

Please sign in to comment.