Improve error message when packfile mmap fails.
If we are unable to mmap the a region of the packfile with the mmap() system call there may be a good reason why, such as a closed file descriptor or out of address space. Reporting the system level error message can help to debug such problems. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Shawn O. Pearce committed
Dec 23, 2006 at 02:34 UTC
73b4e4be7128f75346ce6053d6da1672f243bc74
1 file changed
+3
-1
sha1_file.c
+3
-1
@@ -590,7 +590,9 @@ unsigned char* use_pack(struct packed_git *p,
590
PROT_READ, MAP_PRIVATE,
591
p->pack_fd, win->offset);
592
if (win->base == MAP_FAILED)
593
- die("packfile %s cannot be mapped.", p->pack_name);
593
+ die("packfile %s cannot be mapped: %s",
594
+ p->pack_name,
595
+ strerror(errno));
596
win->next = p->windows;
597
p->windows = win;
598
}