Andrew's git
/
gitweb.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
commit
grep
author
committer
pickaxe
?
re
[PATCH] git: add git_mkstemp()
[gitweb.git]
/
diff.c
diff --git
a/diff.c
b/diff.c
index 4a4b62191284a2289631c01b3a2885387f59a8c0..361d7c09ddfad2cb7e1589367ec74bad8f9ca67d 100644
(file)
--- a/
diff.c
+++ b/
diff.c
@@
-377,8
+377,10
@@
int diff_populate_filespec(struct diff_filespec *s, int size_only)
if (fd < 0)
goto err_empty;
s->data = mmap(NULL, s->size, PROT_READ, MAP_PRIVATE, fd, 0);
- s->should_munmap = 1;
close(fd);
+ if (s->data == MAP_FAILED)
+ goto err_empty;
+ s->should_munmap = 1;
}
else {
char type[20];