diff --git a/src/stream.c b/src/stream.c index ea40657..f6f0ef6 100644 --- a/src/stream.c +++ b/src/stream.c @@ -5,6 +5,7 @@ * Commentary: */ +#include #include #include @@ -95,8 +96,11 @@ void stream_stop(stream_t *stream) case STREAM_TYPE_STRING: free(stream->string.data); break; - case STREAM_TYPE_PIPE: case STREAM_TYPE_FILE: + // ensure we reset the FILE pointer to the start + fseek(stream->pipe.file, 0, SEEK_SET); + // fallthrough + case STREAM_TYPE_PIPE: // Must cleanup vector vec_free(&stream->pipe.cache); break;