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