diff --git a/ChangeLog b/ChangeLog index a88a950948eb673d5398103f3dfc3d608fe99b31..1c127edfb3958c0f6d64e00338b5798281fbab0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2024-05-22 Uwe Schulzweida + + * cdiInqContents: missing lock of non thread-safe netCDF4/HDF5 calls (bug fix) + 2024-05-21 Uwe Schulzweida * Version 2.4.1 released diff --git a/src/stream.c b/src/stream.c index 64402f3dbfb7355067d6a39b9f59042edcb21e38..929cf6124f8c6245c7ea74ed6bd9239090f3176a 100644 --- a/src/stream.c +++ b/src/stream.c @@ -380,6 +380,8 @@ streamFilename(int streamID) static int cdiInqContents(stream_t *streamptr) { + if (streamptr->lockIO) CDI_IO_LOCK(); + int status = 0; int filetype = streamptr->filetype; @@ -418,6 +420,8 @@ cdiInqContents(stream_t *streamptr) } } + if (streamptr->lockIO) CDI_IO_UNLOCK(); + if (status == 0) { int taxisID = vlistInqTaxis(streamptr->vlistID); @@ -667,7 +671,7 @@ streamOpenID(const char *filename, char filemode, int filetype, int resH) if (CDI_Threadsafe) { #ifndef HAVE_LIBPTHREAD - Error("CDI threadsafe failed, pthread support not compiled!"); + Error("CDI threadsafe failed, pthread support not compiled in!"); #endif if (filetype == CDI_FILETYPE_NC4 || filetype == CDI_FILETYPE_NC4C) streamptr->lockIO = true; }