diff --git a/main/gbx/gbx_stream.c b/main/gbx/gbx_stream.c index 90d3047e6..b5c1fcb53 100644 --- a/main/gbx/gbx_stream.c +++ b/main/gbx/gbx_stream.c @@ -291,8 +291,13 @@ void STREAM_close(STREAM *stream) stop_watching(stream, GB_WATCH_NONE); - if (stream->common.standard || !(*(stream->type->close))(stream)) - stream->type = NULL; + if (!stream->common.standard) + { + if ((*(stream->type->close))(stream)) + THROW_SYSTEM(errno, ""); + } + + stream->type = NULL; #if DEBUG_STREAM _nopen--;