aboutsummaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-09-11 11:23:45 -0700
committerJunio C Hamano <gitster@pobox.com>2012-09-11 11:23:54 -0700
commit1c88a6d17492b197b9b3298cbc34efa804928302 (patch)
treeb0370caa6322930a13898673c5a559aef20c8791 /read-cache.c
parent31190841049549b5daaffeb0b9888ebed0bbfc8a (diff)
parente09e4024a070e666ed40b66442e8151b91d623e4 (diff)
downloadgit-1c88a6d17492b197b9b3298cbc34efa804928302.tar.gz
git-1c88a6d17492b197b9b3298cbc34efa804928302.tar.xz
Sync with 1.7.11.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/read-cache.c b/read-cache.c
index d2be78ea9..79e3bbe02 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1414,11 +1414,9 @@ int read_index_from(struct index_state *istate, const char *path)
size_t mmap_size;
struct strbuf previous_name_buf = STRBUF_INIT, *previous_name;
- errno = EBUSY;
if (istate->initialized)
return istate->cache_nr;
- errno = ENOENT;
istate->timestamp.sec = 0;
istate->timestamp.nsec = 0;
fd = open(path, O_RDONLY);
@@ -1431,15 +1429,14 @@ int read_index_from(struct index_state *istate, const char *path)
if (fstat(fd, &st))
die_errno("cannot stat the open index");
- errno = EINVAL;
mmap_size = xsize_t(st.st_size);
if (mmap_size < sizeof(struct cache_header) + 20)
die("index file smaller than expected");
mmap = xmmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
- close(fd);
if (mmap == MAP_FAILED)
die_errno("unable to map index file");
+ close(fd);
hdr = mmap;
if (verify_hdr(hdr, mmap_size) < 0)
@@ -1495,7 +1492,6 @@ int read_index_from(struct index_state *istate, const char *path)
unmap:
munmap(mmap, mmap_size);
- errno = EINVAL;
die("index file corrupt");
}