aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/dirax.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/dirax.c
parent7b6fa15e761ec0c5ae9010dc21786a1a3dda7076 (diff)
Check return values from fread/fgets
Diffstat (limited to 'libcrystfel/src/dirax.c')
-rw-r--r--libcrystfel/src/dirax.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libcrystfel/src/dirax.c b/libcrystfel/src/dirax.c
index 488eb7db..512a61e1 100644
--- a/libcrystfel/src/dirax.c
+++ b/libcrystfel/src/dirax.c
@@ -660,9 +660,12 @@ const char *dirax_probe(UnitCell *cell)
}
fh = fdopen(pty, "r");
- fgets(line, 1024, fh);
- if ( strncmp(line, "dirax", 5) == 0 ) {
- ok = 1;
+ if ( fgets(line, 1024, fh) == NULL ) {
+ ERROR("Failed to probe for DirAx\n");
+ } else {
+ if ( strncmp(line, "dirax", 5) == 0 ) {
+ ok = 1;
+ }
}
fclose(fh);