From 80813462be5e6f0c32805511e87d89bbbc533a65 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 6 Feb 2026 06:04:22 +0000 Subject: [PATCH] stream: ensure stream_stop resets the FILE pointer if STREAM_TYPE_FILE --- src/stream.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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;