From c2668153ef48c3e6ed3d72364783a242d9675bd7 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Tue, 26 Dec 2023 14:52:23 +0000 Subject: [PATCH] Testing: 'close' action and filepool --- src/grib_filepool.cc | 5 +++++ tests/bufr_filter_fail.sh | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/grib_filepool.cc b/src/grib_filepool.cc index 2282fe3eb..8d55f3d3d 100644 --- a/src/grib_filepool.cc +++ b/src/grib_filepool.cc @@ -344,6 +344,11 @@ grib_file* grib_get_file(const char* filename, int* err) { grib_file* file = NULL; + if (!file_pool.current) { + *err = GRIB_IO_PROBLEM; + return NULL; + } + if (file_pool.current->name && !grib_inline_strcmp(filename, file_pool.current->name)) { return file_pool.current; } diff --git a/tests/bufr_filter_fail.sh b/tests/bufr_filter_fail.sh index 74640fd36..ed38ba64c 100755 --- a/tests/bufr_filter_fail.sh +++ b/tests/bufr_filter_fail.sh @@ -90,5 +90,21 @@ set -e grep -q "Cannot include file" $tempErr +# Close +# -------- +cat > $fRules < $tempErr 2>&1 +status=$? +set -e +[ $status -ne 0 ] +cat $tempErr +grep -q "Input output problem" $tempErr + + + # Clean up rm -f $fLog $fRules $tempErr