git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erik Faye-Lund <kusmabite@gmail.com>
To: msysgit@googlegroups.com
Cc: git@vger.kernel.org, Erik Faye-Lund <kusmabite@gmail.com>
Subject: [PATCH] mingw: do not crash on open(NULL, ...)
Date: Thu, 23 Sep 2010 17:35:25 +0000	[thread overview]
Message-ID: <1285263325-2016-1-git-send-email-kusmabite@gmail.com> (raw)

Since open() already sets errno correctly for the NULL-case, let's just
avoid the problematic strcmp.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---
 compat/mingw.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index b0ad919..b408c3c 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -297,7 +297,7 @@ int mingw_open (const char *filename, int oflags, ...)
 	mode = va_arg(args, int);
 	va_end(args);
 
-	if (!strcmp(filename, "/dev/null"))
+	if (filename && !strcmp(filename, "/dev/null"))
 		filename = "nul";
 
 	fd = open(filename, oflags, mode);
-- 
1.7.2.3.msysgit.0.207.gda0b3

             reply	other threads:[~2010-09-23 17:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-23 17:35 Erik Faye-Lund [this message]
2010-09-23 17:59 ` [PATCH] mingw: do not crash on open(NULL, ...) Erik Faye-Lund
2010-09-23 20:27   ` Pat Thoyts
2010-09-23 21:06     ` [msysGit] " Erik Faye-Lund
2010-09-23 22:50   ` Junio C Hamano
2010-09-27 13:19     ` Erik Faye-Lund
2010-09-27 13:31       ` [msysGit] " Pat Thoyts
2010-09-27 13:37         ` Erik Faye-Lund
2010-09-27 13:59         ` Johannes Schindelin
2010-09-24  0:32   ` [msysGit] " Johannes Schindelin
2010-09-23 20:08 ` [msysGit] " Johannes Sixt
2010-09-24 14:22   ` Pat Thoyts

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=1285263325-2016-1-git-send-email-kusmabite@gmail.com \
    --to=kusmabite@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=msysgit@googlegroups.com \
    /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;
as well as URLs for NNTP newsgroup(s).