[PATCH 14/17] Improve error message when packfile mmap fails.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 sha1_file.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/sha1_file.c b/sha1_file.c
index fab2ab0..7872c2d 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -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;
 		}
-- 
1.4.4.3.g87d8

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]