git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mingw: do not crash on open(NULL, ...)
@ 2010-09-23 17:35 Erik Faye-Lund
  2010-09-23 17:59 ` Erik Faye-Lund
  2010-09-23 20:08 ` [msysGit] " Johannes Sixt
  0 siblings, 2 replies; 12+ messages in thread
From: Erik Faye-Lund @ 2010-09-23 17:35 UTC (permalink / raw)
  To: msysgit; +Cc: git, Erik Faye-Lund

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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-09-27 14:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-23 17:35 [PATCH] mingw: do not crash on open(NULL, ...) Erik Faye-Lund
2010-09-23 17:59 ` 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

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).