summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c4712e4)
raw | patch | inline | side by side (parent: c4712e4)
author | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 26 Dec 2006 04:40:58 +0000 (23:40 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 29 Dec 2006 19:36:45 +0000 (11:36 -0800) |
When I converted the mmap() call to xmmap() I failed to cleanup the
way this routine handles errors and left some crufty code behind.
This is a small cleanup, suggested by Johannes.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
way this routine handles errors and left some crufty code behind.
This is a small cleanup, suggested by Johannes.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
read-cache.c | patch | blob | history |
diff --git a/read-cache.c b/read-cache.c
index ca3efbbf0bb61ba3eebe39f31266d6ba77f30eed..29cf9abe6455313d94d169cc5f16aac21cad3228 100644 (file)
--- a/read-cache.c
+++ b/read-cache.c
die("index file open failed (%s)", strerror(errno));
}
- cache_mmap = MAP_FAILED;
if (!fstat(fd, &st)) {
cache_mmap_size = st.st_size;
errno = EINVAL;
if (cache_mmap_size >= sizeof(struct cache_header) + 20)
cache_mmap = xmmap(NULL, cache_mmap_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
- }
+ else
+ die("index file smaller than expected");
+ } else
+ die("cannot stat the open index (%s)", strerror(errno));
close(fd);
- if (cache_mmap == MAP_FAILED)
- die("index file mmap failed (%s)", strerror(errno));
hdr = cache_mmap;
if (verify_hdr(hdr, cache_mmap_size) < 0)