Git development
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Junio C Hamano <junkio@cox.net>,
	Andy Whitcroft <apw@shadowen.org>,
	"Michael S. Tsirkin" <mst@mellanox.co.il>,
	git@vger.kernel.org
Subject: Re: Better error messages for corrupt databases
Date: Thu, 11 Jan 2007 19:40:44 -0500	[thread overview]
Message-ID: <20070112004044.GA23864@spearce.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0701111400031.3594@woody.osdl.org>

Linus Torvalds <torvalds@osdl.org> wrote:
> 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.

  reply	other threads:[~2007-01-12  0:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-11 12:57 tree corrupted on disk quota full Michael S. Tsirkin
2007-01-11 13:40 ` Andreas Ericsson
2007-01-11 13:43   ` Andy Whitcroft
2007-01-11 13:59   ` Michael S. Tsirkin
2007-01-11 14:28     ` Andreas Ericsson
2007-01-11 18:31 ` Linus Torvalds
2007-01-11 19:19   ` Linus Torvalds
2007-01-11 20:03     ` Linus Torvalds
2007-01-11 21:02     ` Junio C Hamano
2007-01-11 21:17     ` Andy Whitcroft
2007-01-11 21:27       ` Junio C Hamano
2007-01-11 22:09         ` Better error messages for corrupt databases Linus Torvalds
2007-01-12  0:40           ` Shawn O. Pearce [this message]
2007-01-11 21:59       ` tree corrupted on disk quota full Linus Torvalds
2007-01-11 22:10         ` Andy Whitcroft
2007-01-11 22:32           ` Linus Torvalds
2007-01-11 21:11   ` Michael S. Tsirkin
2007-01-11 21:50     ` Linus Torvalds
2007-01-11 21:58       ` Michael S. Tsirkin
2007-01-11 22:24         ` Linus Torvalds
2007-01-11 22:39           ` Michael S. Tsirkin
2007-01-12  0:42             ` Linus Torvalds
2007-01-12  0:51               ` Shawn O. Pearce
2007-01-13  0:53           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070112004044.GA23864@spearce.org \
    --to=spearce@spearce.org \
    --cc=apw@shadowen.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=mst@mellanox.co.il \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox