summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-03-07 14:58:05 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-03-07 14:58:05 +0900
commit4687f8790c64b6ebfad179b41e30a02c2a4800ba (patch)
tree21913474682a048fa54bfe7b030d9f8704e8058c
parent30eaee30fa3a8478c23abfc8b3ae11b2cbe7f8aa (diff)
downloadmruby-4687f8790c64b6ebfad179b41e30a02c2a4800ba.tar.gz
mruby-4687f8790c64b6ebfad179b41e30a02c2a4800ba.zip
Merge the update suggested by @mattn; ref #4950
-rw-r--r--mrbgems/mruby-io/src/file.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mrbgems/mruby-io/src/file.c b/mrbgems/mruby-io/src/file.c
index dafcac533..b94649534 100644
--- a/mrbgems/mruby-io/src/file.c
+++ b/mrbgems/mruby-io/src/file.c
@@ -283,8 +283,10 @@ static int
mrb_file_is_absolute_path(const char *path)
{
#ifdef _WIN32
- if (strlen(path) < 2) return 0;
- return path[0] >= 64 && path[0] <= 90 && path[1] == ':'; // 64 to 90 is ASCII
+#define IS_PATHSEP(x) (x == '/' || x == '\')
+ if (strlen(path) < 3) return 0;
+ return (isalpha(path[0]) && path[1] == ':' && IS_PATHSEP(path[2]));
+#undef IS_PATHSEP
#else
return (path[0] == '/');
#endif