From 351dbaeff9d2b51ab0732cf00ce174e7dff85c88 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 23 Sep 2010 17:35:25 +0000 Subject: [PATCH] mingw: do not crash on open(NULL, ...) fetch_and_setup_pack_index() apparently pass a NULL-pointer to parse_pack_index(), which in turn pass it to check_packed_git_idx(), which again pass it to open(). Since open() already sets errno correctly for the NULL-case, let's just avoid the problematic strcmp. Acked-by: Johannes Sixt Signed-off-by: Erik Faye-Lund Signed-off-by: Pat Thoyts --- compat/mingw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/mingw.c b/compat/mingw.c index b0ad9192fb..b408c3c161 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);