diff options
Diffstat (limited to 'builtin-merge-file.c')
-rw-r--r-- | builtin-merge-file.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin-merge-file.c b/builtin-merge-file.c index adce6d463..3605960c2 100644 --- a/builtin-merge-file.c +++ b/builtin-merge-file.c @@ -57,7 +57,8 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix) if (!f) ret = error("Could not open %s for writing", filename); - else if (fwrite(result.ptr, result.size, 1, f) != 1) + else if (result.size && + fwrite(result.ptr, result.size, 1, f) != 1) ret = error("Could not write to %s", filename); else if (fclose(f)) ret = error("Could not close %s", filename); |