aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/mosflm.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/mosflm.c
parent7b6fa15e761ec0c5ae9010dc21786a1a3dda7076 (diff)
Check return values from fread/fgets
Diffstat (limited to 'libcrystfel/src/mosflm.c')
-rw-r--r--libcrystfel/src/mosflm.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libcrystfel/src/mosflm.c b/libcrystfel/src/mosflm.c
index 14cd9d96..7ebf6e19 100644
--- a/libcrystfel/src/mosflm.c
+++ b/libcrystfel/src/mosflm.c
@@ -896,12 +896,16 @@ const char *mosflm_probe(UnitCell *cell)
for ( l=0; l<10; l++ ) {
char *pos;
- fgets(line, 1024, fh);
- pos = strstr(line, "Mosflm version ");
- if ( pos != NULL ) {
- char *vers = pos+15;
- ok = 1;
- chop_word(vers);
+ if ( fgets(line, 1024, fh) == NULL ) {
+ ERROR("Failed to probe for Mosflm\n");
+ } else {
+ pos = strstr(line, "Mosflm version ");
+ if ( pos != NULL ) {
+ char *vers = pos+15;
+ ok = 1;
+ chop_word(vers);
+ /* FIXME: Set capabilities based on version */
+ }
}
}