diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-05-01 22:39:55 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-05-01 22:39:55 +0200 |
commit | 29d74275c44c1636acabdb5a3822c3872ebf43de (patch) | |
tree | 357838ee387521af342297f7f17459449b1a6c27 | |
parent | Merge branch 'ds/blame-on-bloom' (diff) | |
parent | multi-pack-index: close file descriptor after mmap (diff) | |
download | git-29d74275c44c1636acabdb5a3822c3872ebf43de.tar.xz git-29d74275c44c1636acabdb5a3822c3872ebf43de.zip |
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
-rw-r--r-- | midx.c | 4 | ||||
-rw-r--r-- | midx.h | 2 |
2 files changed, 1 insertions, 5 deletions
@@ -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]) @@ -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; |