Re: Better error messages for corrupt databases
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Jan 12, 2007, 00:40 UTC
- Message-ID
- <20070112004044.GA23864@spearce.org>
- In-Reply-To
- <Pine.LNX.4.64.0701111400031.3594@woody.osdl.org>
Linus Torvalds <torvalds@osdl.org> wrote:
Show 6 quoted lines
> So this just makes "xmmap()" return NULL for a zero-sized object (which is > a valid thing pointer, exactly the same way "malloc()" can return NULL for > a zero-sized allocation). That fixes the first problem (but we could have > fixed it in the caller too - I don't personally much care whichever way it > goes, but maybe somebody should check that the NO_MMAP case does > something sane in this case too?).
All calls to perform any sort of mmap go through xmmap(). If NO_MMAP was defined at compile time than the mmap() call within xmmap() is redefined to invoke git_mmap() via a preprocessor define slightly earlier in git-compat-util.h.
So your patch will also automatically do the right thing in the NO_MMAP case.
BTW, I like your solution of just fixing it here in xmmap(). Good idea.
-- Shawn.