]> git.ipfire.org Git - thirdparty/git.git/blobdiff - write-or-die.c
reftable: fix resource leak in block.c error path
[thirdparty/git.git] / write-or-die.c
index d33e68f6abb30aed23d53909c1b855ad352a7baa..0b1ec8190b622d18751aef3d0e640bf3d0e63b97 100644 (file)
@@ -70,3 +70,15 @@ void write_or_die(int fd, const void *buf, size_t count)
                die_errno("write error");
        }
 }
+
+void fwrite_or_die(FILE *f, const void *buf, size_t count)
+{
+       if (fwrite(buf, 1, count, f) != count)
+               die_errno("fwrite error");
+}
+
+void fflush_or_die(FILE *f)
+{
+       if (fflush(f))
+               die_errno("fflush error");
+}