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 <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Peter Harris committed
May 23, 2009 at 10:04 UTC
bedc4279a833dc7f17ea7d1730d9f3e4ff018729
1 file changed
+2
-2
compat/mingw.c
+2
-2
@@ -525,8 +525,8 @@ static const char *parse_interpreter(const char *cmd)
525
if (buf[0] != '#' || buf[1] != '!')
526
return NULL;
527
buf[n] = '\0';
528
- p = strchr(buf, '\n');
529
- if (!p)
528
+ p = buf + strcspn(buf, "\r\n");
529
+ if (!*p)
530
return NULL;
531
532
*p = '\0';