diff options
author | Peter Harris <git@peter.is-a-geek.org> | 2009-05-23 12:04:47 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-05-23 12:54:45 +0400 |
commit | bedc4279a833dc7f17ea7d1730d9f3e4ff018729 (patch) | |
tree | 0d2712e0459a6997643674b9dee482245e2ec9dc | |
parent | 7f5a68ad4d0e00eb2f28405946ec0f2691d7ad81 (diff) |
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>
-rw-r--r-- | compat/mingw.c | 4 |
1 files 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'; |