зеркало из https://github.com/microsoft/git.git
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:
Коммит
29d74275c4
4
midx.c
4
midx.c
|
@ -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
2
midx.h
|
@ -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;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче