aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/image-hdf5.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-07-01 16:54:32 +0200
committerThomas White <taw@physics.org>2020-07-29 18:53:44 +0200
commit9040220452a9cc02706159c21c78e43b374446cf (patch)
tree2bdee963864fc3ea3a43a679c6a932f621e763d4 /libcrystfel/src/image-hdf5.c
parent2e6c22d51ce130180f9d6e13f894c86fe3027e2e (diff)
is_hdf5_file: Only check extension
It seems that H5Fis_hdf5 doesn't close the file. So, we rapidly run out of file descriptors. Also, opening each file just to enumerate single-frame files seems like a waste of time.
Diffstat (limited to 'libcrystfel/src/image-hdf5.c')
-rw-r--r--libcrystfel/src/image-hdf5.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libcrystfel/src/image-hdf5.c b/libcrystfel/src/image-hdf5.c
index 26caa13a..f698fed7 100644
--- a/libcrystfel/src/image-hdf5.c
+++ b/libcrystfel/src/image-hdf5.c
@@ -1644,5 +1644,10 @@ char **image_hdf5_expand_frames(const DataTemplate *dtempl,
int is_hdf5_file(const char *filename)
{
- return (H5Fis_hdf5(filename) > 0);
+ const char *ext = NULL;
+
+ ext = filename_extension(filename, NULL);
+ if ( ext == NULL ) return 0;
+
+ return (strcmp(ext, ".h5") == 0);
}