summaryrefslogtreecommitdiff
path: root/xdiff-interface.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-03-14 00:16:42 -0700
committerJunio C Hamano <gitster@pobox.com>2008-03-14 00:16:42 -0700
commit16007f3916b885d29de6c48832aa6a4213ab7588 (patch)
treea32a16393cb312398d8c96e61daef15cb708b7f2 /xdiff-interface.c
parentca885a4fe6444bed840295378848904106c87c85 (diff)
parent1b56bc9a1545902db64b8bdce48a499900acfe0b (diff)
downloadgit-16007f3916b885d29de6c48832aa6a4213ab7588.tar.gz
Merge branch 'maint'
* maint: merge-file: handle empty files gracefully merge-recursive: handle file mode changes Minor wording changes in the keyboard descriptions in git-add --interactive. git fetch: Take '-n' to mean '--no-tags' quiltimport: fix misquoting of parsed -p<num> parameter git-quiltimport: better parser to grok "enhanced" series files.
Diffstat (limited to 'xdiff-interface.c')
-rw-r--r--xdiff-interface.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/xdiff-interface.c b/xdiff-interface.c
index bba236428a..61dc5c5470 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -152,8 +152,8 @@ int read_mmfile(mmfile_t *ptr, const char *filename)
if ((f = fopen(filename, "rb")) == NULL)
return error("Could not open %s", filename);
sz = xsize_t(st.st_size);
- ptr->ptr = xmalloc(sz);
- if (fread(ptr->ptr, sz, 1, f) != 1)
+ ptr->ptr = xmalloc(sz ? sz : 1);
+ if (sz && fread(ptr->ptr, sz, 1, f) != 1)
return error("Could not read %s", filename);
fclose(f);
ptr->size = sz;