aboutsummaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-09-11 10:53:21 -0700
committerJunio C Hamano <gitster@pobox.com>2012-09-11 10:53:21 -0700
commitd8ce800531d0c5c26cdc076fe2b9e70d25fe7f81 (patch)
tree31a3bd6933c0ac15bee592c96c3a52beb798a784 /read-cache.c
parent10a32fa95466f0c16531fe9b3d3f9a190f90f5f2 (diff)
parent57d84f8d93a0e0818fc403c5b1a2ba73ce0eca5a (diff)
downloadgit-d8ce800531d0c5c26cdc076fe2b9e70d25fe7f81.tar.gz
git-d8ce800531d0c5c26cdc076fe2b9e70d25fe7f81.tar.xz
Merge branch 'nd/index-errno' into maint-1.7.11
* nd/index-errno: read_index_from: remove bogus errno assignments
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 7d4bf68e3..d8543e4d4 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1409,11 +1409,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);
@@ -1426,15 +1424,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)
@@ -1490,7 +1487,6 @@ int read_index_from(struct index_state *istate, const char *path)
unmap:
munmap(mmap, mmap_size);
- errno = EINVAL;
die("index file corrupt");
}