aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/xds.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-10-23 15:53:19 +0200
committerThomas White <taw@physics.org>2017-10-23 16:01:37 +0200
commit45038c42847476ce1aee5b09c47fb330a0108cd6 (patch)
tree3979667c80cacc3bd34d0f59fc905a0d4c0b3d0d /libcrystfel/src/xds.c
parent7b6fa15e761ec0c5ae9010dc21786a1a3dda7076 (diff)
Check return values from fread/fgets
Diffstat (limited to 'libcrystfel/src/xds.c')
-rw-r--r--libcrystfel/src/xds.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libcrystfel/src/xds.c b/libcrystfel/src/xds.c
index bd98aec4..bfb977ea 100644
--- a/libcrystfel/src/xds.c
+++ b/libcrystfel/src/xds.c
@@ -679,10 +679,13 @@ const char *xds_probe(UnitCell *cell)
for ( l=0; l<10; l++ ) {
char *pos;
- fgets(line, 1024, fh);
- pos = strstr(line, "** XDS **");
- if ( pos != NULL ) {
- ok = 1;
+ if ( fgets(line, 1024, fh) == NULL ) {
+ ERROR("Failed to probe for XDS\n");
+ } else {
+ pos = strstr(line, "** XDS **");
+ if ( pos != NULL ) {
+ ok = 1;
+ }
}
}