From bedc4279a833dc7f17ea7d1730d9f3e4ff018729 Mon Sep 17 00:00:00 2001 From: Peter Harris Date: Sat, 23 May 2009 10:04:47 +0200 Subject: [PATCH] MinGW: Scan for \r in addition to \n when reading shbang lines \r is common on Windows, so we should handle it gracefully. Signed-off-by: Steffen Prohaska Signed-off-by: Junio C Hamano --- compat/mingw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compat/mingw.c b/compat/mingw.c index cdeda1d985..b723c4dfd6 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -525,8 +525,8 @@ static const char *parse_interpreter(const char *cmd) if (buf[0] != '#' || buf[1] != '!') return NULL; buf[n] = '\0'; - p = strchr(buf, '\n'); - if (!p) + p = buf + strcspn(buf, "\r\n"); + if (!*p) return NULL; *p = '\0';