diff options
author | Peter Harris <git@peter.is-a-geek.org> | 2009-05-23 10:04:47 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-05-23 01:54:45 -0700 |
commit | bedc4279a833dc7f17ea7d1730d9f3e4ff018729 (patch) | |
tree | 0d2712e0459a6997643674b9dee482245e2ec9dc /compat | |
parent | 7f5a68ad4d0e00eb2f28405946ec0f2691d7ad81 (diff) | |
download | git-bedc4279a833dc7f17ea7d1730d9f3e4ff018729.tar.gz git-bedc4279a833dc7f17ea7d1730d9f3e4ff018729.tar.xz |
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>
Diffstat (limited to 'compat')
-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 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'; |