Skip to content

Commit

Permalink
Improve error message when packfile mmap fails.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce authored and Junio C Hamano committed Dec 29, 2006
1 parent 40be827 commit 73b4e4b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,9 @@ unsigned char* use_pack(struct packed_git *p,
PROT_READ, MAP_PRIVATE,
p->pack_fd, win->offset);
if (win->base == MAP_FAILED)
die("packfile %s cannot be mapped.", p->pack_name);
die("packfile %s cannot be mapped: %s",
p->pack_name,
strerror(errno));
win->next = p->windows;
p->windows = win;
}
Expand Down

0 comments on commit 73b4e4b

Please sign in to comment.