git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Alex Riesen <raa.lkml@gmail.com>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Clean up compatibility definitions.
Date: Tue, 6 Dec 2005 09:07:04 +0100	[thread overview]
Message-ID: <81b0412b0512060007s589e1d0dr4f47da68a7f3567a@mail.gmail.com> (raw)
In-Reply-To: <7vk6ei65r6.fsf@assigned-by-dhcp.cox.net>

[-- Attachment #1: Type: text/plain, Size: 605 bytes --]

On 12/6/05, Junio C Hamano <junkio@cox.net> wrote:
> > ... 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? The patch is not really tested (running
tests is not useful in this case), but I looked over the call sites,
and they seem either to handle mmap's or the previous open's return
values.
One exception is in config.c where neither is handled, the code will
race between stat and open.

Signed-off-by: Alex Riesen <fork0@gmail.com>

[-- Attachment #2: 0004-cleanup-mmap-fake.-No-need-to-output-anything-callers-handle-the-return-value.txt --]
[-- Type: text/plain, Size: 849 bytes --]

cleanup mmap fake. No need to output anything, callers handle the return value

Signed-off-by: Alex Riesen <fork0@gmail.com>

---

 compat/mmap.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

311da12b7aaca9b7329a07807e1ce4afba4bff77
diff --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;
+	}
 
 	if (lseek(fd, offset, SEEK_SET) < 0) {
 		errno = EINVAL;
 		return MAP_FAILED;
 	}
 
-	start = xmalloc(length);
+	start = malloc(length);
 	if (start == NULL) {
 		errno = ENOMEM;
 		return MAP_FAILED;
-- 
0.99.9.GIT

  reply	other threads:[~2005-12-06  8:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-05 13:19 make gitfakemmap standalone to fix linking error in git.c Alex Riesen
2005-12-05 13:24 ` Alex Riesen
2005-12-05 14:11   ` Petr Baudis
2005-12-05 15:43     ` Alex Riesen
2005-12-05 17:40   ` Junio C Hamano
2005-12-05 20:22     ` [PATCH] Clean up compatibility definitions Junio C Hamano
2005-12-05 20:36       ` Johannes Schindelin
2005-12-05 20:51         ` Junio C Hamano
2005-12-05 21:39           ` Alex Riesen
2005-12-06  7:35             ` Alex Riesen
2005-12-06  7:58               ` Junio C Hamano
2005-12-05 21:50       ` Alex Riesen
2005-12-05 21:58         ` Junio C Hamano
2005-12-06  7:15           ` Alex Riesen
2005-12-06  7:31             ` Junio C Hamano
2005-12-06  8:07               ` Alex Riesen [this message]
2005-12-06  8:11                 ` Junio C Hamano
2005-12-05 23:12       ` Petr Baudis
2005-12-06  3:17         ` Junio C Hamano
2005-12-06  9:53           ` Petr Baudis
2005-12-05 21:36     ` make gitfakemmap standalone to fix linking error in git.c Alex Riesen
2005-12-05 21:49       ` Junio C Hamano
2005-12-06  7:49         ` Alex Riesen

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=81b0412b0512060007s589e1d0dr4f47da68a7f3567a@mail.gmail.com \
    --to=raa.lkml@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).