summaryrefslogtreecommitdiff
path: root/src/path.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-06-08 13:56:53 -0700
committerRussell Belfer <rb@github.com>2012-06-08 13:56:53 -0700
commitd17db71b6f8343204683542538416ec87e06261e (patch)
tree17705eb477a5c23f2d1455b06564b91e44e1b7da /src/path.c
parent145e696b498a046762e4df9045c9b71440308486 (diff)
downloadlibgit2-d17db71b6f8343204683542538416ec87e06261e.tar.gz
isalpha is not great for UTF-8
When checking for a drive letter on windows, instead of using isalpha(), it is better to just check for a..z and A..Z, I think, particularly because the MS isalpha implementation appears to assert when given an 0xFF byte.
Diffstat (limited to 'src/path.c')
-rw-r--r--src/path.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/path.c b/src/path.c
index 84edf6d89..c61f18c9d 100644
--- a/src/path.c
+++ b/src/path.c
@@ -170,7 +170,8 @@ int git_path_root(const char *path)
#ifdef GIT_WIN32
/* Does the root of the path look like a windows drive ? */
- if (isalpha(path[0]) && (path[1] == ':'))
+ if (((path[0] >= 'a' && path[0] <= 'z') ||
+ (path[0] >= 'A' && path[0] <= 'Z')) && path[1] == ':')
offset += 2;
/* Are we dealing with a windows network path? */