netem/maketable: Check return value of fscanf()

Signed-off-by: Phil Sutter <phil@nwl.cc>
This commit is contained in:
Phil Sutter 2017-08-24 11:41:28 +02:00 committed by Stephen Hemminger
parent 0aa03350c0
commit 92963d136d
1 changed files with 2 additions and 2 deletions

View File

@ -38,8 +38,8 @@ readdoubles(FILE *fp, int *number)
} }
for (i=0; i<limit; ++i){ for (i=0; i<limit; ++i){
fscanf(fp, "%lf", &x[i]); if (fscanf(fp, "%lf", &x[i]) != 1 ||
if (feof(fp)) feof(fp))
break; break;
++n; ++n;
} }