diff options
author | Thomas White <taw@physics.org> | 2017-10-23 15:53:19 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2017-10-23 16:01:37 +0200 |
commit | 45038c42847476ce1aee5b09c47fb330a0108cd6 (patch) | |
tree | 3979667c80cacc3bd34d0f59fc905a0d4c0b3d0d /src/ambigator.c | |
parent | 7b6fa15e761ec0c5ae9010dc21786a1a3dda7076 (diff) |
Check return values from fread/fgets
Diffstat (limited to 'src/ambigator.c')
-rw-r--r-- | src/ambigator.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ambigator.c b/src/ambigator.c index f7837721..3df66f3b 100644 --- a/src/ambigator.c +++ b/src/ambigator.c @@ -1254,8 +1254,11 @@ int main(int argc, char *argv[]) return 1; } - fread(&seed, sizeof(seed), 1, fh); - gsl_rng_set(rng, seed); + if ( fread(&seed, sizeof(seed), 1, fh) == 1 ) { + gsl_rng_set(rng, seed); + } else { + ERROR("Failed to seed RNG\n"); + } fclose(fh); } |