From: Michael Tremer Date: Sat, 11 May 2024 10:56:26 +0000 (+0100) Subject: writer: Move the cursor back to end when finished writing X-Git-Tag: 0.9.18~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f9a55387589e97aab892fdbf44e5b3e0419a78f8;p=location%2Flibloc.git writer: Move the cursor back to end when finished writing Signed-off-by: Michael Tremer --- diff --git a/src/writer.c b/src/writer.c index 5ea992b..ec5f896 100644 --- a/src/writer.c +++ b/src/writer.c @@ -774,6 +774,11 @@ LOC_EXPORT int loc_writer_write(struct loc_writer* writer, FILE* f, enum loc_dat return r; } + // Seek back to the end + r = fseek(f, 0, SEEK_END); + if (r) + return r; + // Flush everything fflush(f);