Merge branch 'ds/multi-pack-index'

The multi-pack-index left mmapped file descriptors open when it
does not have to.

* ds/multi-pack-index:
  multi-pack-index: close file descriptor after mmap
This commit is contained in:
Junio C Hamano 2020-05-01 13:39:55 -07:00
commit 29d74275c4
2 changed files with 1 additions and 5 deletions

4
midx.c
View File

@ -72,9 +72,9 @@ struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local
FREE_AND_NULL(midx_name);
midx_map = xmmap(NULL, midx_size, PROT_READ, MAP_PRIVATE, fd, 0);
close(fd);
FLEX_ALLOC_STR(m, object_dir, object_dir);
m->fd = fd;
m->data = midx_map;
m->data_len = midx_size;
m->local = local;
@ -190,8 +190,6 @@ void close_midx(struct multi_pack_index *m)
return;
munmap((unsigned char *)m->data, m->data_len);
close(m->fd);
m->fd = -1;
for (i = 0; i < m->num_packs; i++) {
if (m->packs[i])

2
midx.h
View File

@ -12,8 +12,6 @@ struct repository;
struct multi_pack_index {
struct multi_pack_index *next;
int fd;
const unsigned char *data;
size_t data_len;