Browse Source

Merge branch 'rs/sha1-file-close-mapped-file-on-error'

Code clean-up.

* rs/sha1-file-close-mapped-file-on-error:
  sha1-file: close fd of empty file in map_sha1_file_1()
maint
Junio C Hamano 6 years ago
parent
commit
2c0a645d9e
  1. 1
      sha1-file.c

1
sha1-file.c

@ -960,6 +960,7 @@ static void *map_sha1_file_1(struct repository *r, const char *path, @@ -960,6 +960,7 @@ static void *map_sha1_file_1(struct repository *r, const char *path,
if (!*size) {
/* mmap() is forbidden on empty files */
error(_("object file %s is empty"), path);
close(fd);
return NULL;
}
map = xmmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);

Loading…
Cancel
Save