Skip to content
Snippets Groups Projects
Commit e35f9824 authored by Pavel Roskin's avatar Pavel Roskin Committed by Junio C Hamano
Browse files

[PATCH] mmap error handling


I have reviewed all occurrences of mmap() in git and fixed three types
of errors/defects:

1) The result is not checked.
2) The file descriptor is closed if mmap() succeeds, but not when it
fails.
3) Various casts applied to -1 are used instead of MAP_FAILED, which is
specifically defined to check mmap() return value.

[jc: This is a second round of Pavel's patch.  He fixed up the problem
that close() potentially clobbering the errno from mmap, which
the first round had.]

Signed-off-by: default avatarPavel Roskin <proski@gnu.org>
Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
parent 1df092d2
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment