diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-08-22 11:51:42 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-08-22 11:51:42 -0700 |
commit | d0ae7e2e71a6d8b9eb198ed0a5e1462013f7c65d (patch) | |
tree | 2be589649f1a0ef06d6b7f0f7cfb10152e03d4d8 /read-cache.c | |
parent | c90f06efd84ef0ace0c92509a8bfa1bb1d8b05a8 (diff) | |
parent | 57d84f8d93a0e0818fc403c5b1a2ba73ce0eca5a (diff) | |
download | git-d0ae7e2e71a6d8b9eb198ed0a5e1462013f7c65d.tar.gz |
Merge branch 'nd/index-errno'
Assignments to errno before calling system functions that used to
matter in the old code were left behind after the code structure
changed sufficiently to make them useless.
* nd/index-errno:
read_index_from: remove bogus errno assignments
Diffstat (limited to 'read-cache.c')
-rw-r--r-- | read-cache.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/read-cache.c b/read-cache.c index 2f8159fb16..76513cdc8f 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"); } |