]> git.ipfire.org Git - thirdparty/git.git/blobdiff - compat/mingw.c
MinGW: Scan for \r in addition to \n when reading shbang lines
[thirdparty/git.git] / compat / mingw.c
index cdeda1d9859fd545950e0c39ee7de3c9dc09bb07..b723c4dfd63ef3021e47419bd2dbe570b8ec7b11 100644 (file)
@@ -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';