summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils.c b/utils.c
index d9ac4cf..a96e56e 100644
--- a/utils.c
+++ b/utils.c
@@ -109,7 +109,7 @@ binary_print(const char *s, ssize_t len)
void
xfwrite(const void *ptr, size_t size, FILE *stream)
{
- if (fwrite(ptr, size, 1, stream) != 1) {
+ if (size && fwrite(ptr, size, 1, stream) != 1) {
msg(MSG_CRITICAL, "Failed to write to file: %s\n",
strerror(errno));
exit(EXIT_FAILURE);