summaryrefslogtreecommitdiffstats
path: root/hl/test/test_ds.c
diff options
context:
space:
mode:
Diffstat (limited to 'hl/test/test_ds.c')
-rw-r--r--hl/test/test_ds.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c
index 7b6fb82..47929e6 100644
--- a/hl/test/test_ds.c
+++ b/hl/test/test_ds.c
@@ -4870,8 +4870,16 @@ static int read_data( const char* fname,
}
for(i=0, nelms=1; i < ndims; i++) {
- fscanf( f, "%s %u", str, &j);
- fscanf( f, "%d",&n );
+ if(fscanf( f, "%s %u", str, &j) && HDferror(f)) {
+ printf( "fscanf error in file %s\n", data_file );
+ HDfclose(f);
+ return -1;
+ } /* end if */
+ if(fscanf( f, "%d",&n ) < 0 && HDferror(f)) {
+ printf( "fscanf error in file %s\n", data_file );
+ HDfclose(f);
+ return -1;
+ } /* end if */
dims[i] = (hsize_t)n;
nelms *= (size_t)n;
}
@@ -4885,7 +4893,11 @@ static int read_data( const char* fname,
}
for(j = 0; j < nelms; j++) {
- fscanf( f, "%f",&val );
+ if(fscanf( f, "%f",&val ) < 0 && HDferror(f)) {
+ printf( "fscanf error in file %s\n", data_file );
+ HDfclose(f);
+ return -1;
+ } /* end if */
(*buf)[j] = val;
}
HDfclose(f);