Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'rs/sha1-file-close-mapped-file-on-error'
author
Junio C Hamano
<gitster@pobox.com>
Fri, 18 Jan 2019 21:49:56 +0000
(13:49 -0800)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 18 Jan 2019 21:49:56 +0000
(13:49 -0800)
Code clean-up.
* rs/sha1-file-close-mapped-file-on-error:
sha1-file: close fd of empty file in map_sha1_file_1()
sha1-file.c
patch
|
blob
|
history
raw
(from parent 1:
eb8638a
)
diff --git
a/sha1-file.c
b/sha1-file.c
index efcb2cbe747683297d2551da85e95b864120f692..386b96e1d76622e4650c1bbab90092fef7dd7303 100644
(file)
--- a/
sha1-file.c
+++ b/
sha1-file.c
@@
-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);