Re: [PATCH] Clean up compatibility definitions.
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:14
Alex Riesen [off-list ref] writes:
On 12/6/05, Junio C Hamano [off-list ref] wrote:quoted
quoted
... return MAP_FAILED if error, do not exit process, do no output.Ah, that is what you meant. I agree.now, while we agree, how about the patch removing "user interface" from gitfakemmap altogether?
quoted hunk
311da12b7aaca9b7329a07807e1ce4afba4bff77diff --git a/compat/mmap.c b/compat/mmap.c index 55cb120..32d7a30 100644 --- a/compat/mmap.c +++ b/compat/mmap.c@@ -8,15 +8,17 @@ void *gitfakemmap(void *start, size_t le { int n = 0; - if (start != NULL || !(flags & MAP_PRIVATE)) - die("Invalid usage of gitfakemmap."); + if (start != NULL || !(flags & MAP_PRIVATE)) { + errno = ENOTSUP; + return MAP_FAILED; + }
I've considered this one after hearing what you meant by your previous comment, but I am slightly in favor of keeping this die(); what would trigger this is a programmer error, and the extra error message from die() makes it obvious, although I agree that it is unclean from purist point of view. On the other hand,
- start = xmalloc(length); + start = malloc(length);
This one I'd agree with 100%.