From 5ca91a38d9d7cef6de138669446a614f18cbc590 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 2 Mar 2022 09:47:25 +0100 Subject: Move file_exists() check to right before opening the HDF5 No other code path under image_expand_frames() actually opens the file, because HDF5s are currently the only format supporting multiple frames. The aim of the existence check is to give a better error message (compared to the HDF5 backtrace splurge), but it doesn't need to be done so early. In fact, checking so early had the side-effect of breaking indexamajig --wait-for-file. Fixes: https://gitlab.desy.de/thomas.white/crystfel/-/issues/65 --- libcrystfel/src/image-hdf5.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libcrystfel/src/image-hdf5.c') diff --git a/libcrystfel/src/image-hdf5.c b/libcrystfel/src/image-hdf5.c index 07e3b6b8..ce357f36 100644 --- a/libcrystfel/src/image-hdf5.c +++ b/libcrystfel/src/image-hdf5.c @@ -1830,6 +1830,10 @@ char **image_hdf5_expand_frames(const DataTemplate *dtempl, return full_evs.events; } + if ( !file_exists(filename) ) { + ERROR("File not found: %s (hdf5_expand_frames)\n", filename); + return NULL; + } fh = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); if ( fh < 0 ) { -- cgit v1.2.3