From: Peter Harris Date: Sat, 23 May 2009 08:04:47 +0000 (+0200) Subject: MinGW: Scan for \r in addition to \n when reading shbang lines X-Git-Tag: v1.6.4-rc0~128 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bedc4279a833dc7f17ea7d1730d9f3e4ff018729;p=git.git 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 --- diff --git a/compat/mingw.c b/compat/mingw.c index cdeda1d98..b723c4dfd 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';