Skip to content

Commit

Permalink
MinGW: Scan for \r in addition to \n when reading shbang lines
Browse files Browse the repository at this point in the history
\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>
  • Loading branch information
Peter Harris authored and Junio C Hamano committed May 23, 2009
1 parent 7f5a68a commit bedc427
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit bedc427

Please sign in to comment.