]> git.ipfire.org Git - location/libloc.git/commitdiff
writer: Move the cursor back to end when finished writing
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 11 May 2024 10:56:26 +0000 (11:56 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 11 May 2024 10:56:26 +0000 (11:56 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/writer.c

index 5ea992b71ac52f573b43d3a0697c8b279dfa4366..ec5f89618c9900dc982a296ebd854aa475779d0d 100644 (file)
@@ -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);