Skip to content

Commit d8ce800

Browse files
committed
Merge branch 'nd/index-errno' into maint-1.7.11
* nd/index-errno: read_index_from: remove bogus errno assignments
2 parents 10a32fa + 57d84f8 commit d8ce800

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

read-cache.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,11 +1409,9 @@ int read_index_from(struct index_state *istate, const char *path)
14091409
size_t mmap_size;
14101410
struct strbuf previous_name_buf = STRBUF_INIT, *previous_name;
14111411

1412-
errno = EBUSY;
14131412
if (istate->initialized)
14141413
return istate->cache_nr;
14151414

1416-
errno = ENOENT;
14171415
istate->timestamp.sec = 0;
14181416
istate->timestamp.nsec = 0;
14191417
fd = open(path, O_RDONLY);
@@ -1426,15 +1424,14 @@ int read_index_from(struct index_state *istate, const char *path)
14261424
if (fstat(fd, &st))
14271425
die_errno("cannot stat the open index");
14281426

1429-
errno = EINVAL;
14301427
mmap_size = xsize_t(st.st_size);
14311428
if (mmap_size < sizeof(struct cache_header) + 20)
14321429
die("index file smaller than expected");
14331430

14341431
mmap = xmmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
1435-
close(fd);
14361432
if (mmap == MAP_FAILED)
14371433
die_errno("unable to map index file");
1434+
close(fd);
14381435

14391436
hdr = mmap;
14401437
if (verify_hdr(hdr, mmap_size) < 0)
@@ -1490,7 +1487,6 @@ int read_index_from(struct index_state *istate, const char *path)
14901487

14911488
unmap:
14921489
munmap(mmap, mmap_size);
1493-
errno = EINVAL;
14941490
die("index file corrupt");
14951491
}
14961492

0 commit comments

Comments
 (0)