diff options
author | Phil Sutter <phil@nwl.cc> | 2017-08-21 11:27:03 +0200 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2017-08-21 17:17:00 -0700 |
commit | d304b05c12b3a0247b627ebc8e4477520bb4b969 (patch) | |
tree | 4c7532902a97027ece6989afa3d7a38279185898 /netem | |
parent | 301826beb3baa902e2057d81912d1586459f605f (diff) |
netem/maketable: Check return value of fstat()
Otherwise info.st_size may contain garbage.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'netem')
-rw-r--r-- | netem/maketable.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/netem/maketable.c b/netem/maketable.c index 6aff927b..ad660e7d 100644 --- a/netem/maketable.c +++ b/netem/maketable.c @@ -24,8 +24,8 @@ readdoubles(FILE *fp, int *number) int limit; int n=0, i; - fstat(fileno(fp), &info); - if (info.st_size > 0) { + if (!fstat(fileno(fp), &info) && + info.st_size > 0) { limit = 2*info.st_size/sizeof(double); /* @@ approximate */ } else { limit = 10000; |