Browse Source

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>
maint
Peter Harris 16 years ago committed by Junio C Hamano
parent
commit
bedc4279a8
  1. 4
      compat/mingw.c

4
compat/mingw.c

@ -525,8 +525,8 @@ static const char *parse_interpreter(const char *cmd) @@ -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';

Loading…
Cancel
Save