Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'mm/empty-loose-error-message'
author
Junio C Hamano
<gitster@pobox.com>
Mon, 13 Feb 2012 06:42:02 +0000
(22:42 -0800)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 13 Feb 2012 06:42:02 +0000
(22:42 -0800)
* mm/empty-loose-error-message:
fsck: give accurate error message on empty loose object files
sha1_file.c
patch
|
blob
|
history
raw
(from parent 1:
39ee171
)
diff --git
a/sha1_file.c
b/sha1_file.c
index 88f2151ff31870138a53e40f99f5ae9928b09545..d9aa0e0a2cd45acbbe3beb6c015f5f9071a22902 100644
(file)
--- a/
sha1_file.c
+++ b/
sha1_file.c
@@
-1202,6
+1202,11
@@
void *map_sha1_file(const unsigned char *sha1, unsigned long *size)
if (!fstat(fd, &st)) {
*size = xsize_t(st.st_size);
+ if (!*size) {
+ /* mmap() is forbidden on empty files */
+ error("object file %s is empty", sha1_file_name(sha1));
+ return NULL;
+ }
map = xmmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);
}
close(fd);