summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorReckordp <[email protected]>2020-03-07 15:50:14 +0700
committerReckordp <[email protected]>2020-03-07 15:50:14 +0700
commit5a4b9fd8772a7bd34c8866716a7622237fed5e7b (patch)
tree23306a8df125af59f86efdb3402098151882a4ad
parentf319c5fb2641b4cb38ca81f136e808db612aaa6f (diff)
downloadmruby-5a4b9fd8772a7bd34c8866716a7622237fed5e7b.tar.gz
mruby-5a4b9fd8772a7bd34c8866716a7622237fed5e7b.zip
Add absolute path for UNC
-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 c8f13b313..ffce0ddcb 100644
--- a/mrbgems/mruby-io/src/file.c
+++ b/mrbgems/mruby-io/src/file.c
@@ -284,8 +284,10 @@ mrb_file_is_absolute_path(const char *path)
{
#ifdef _WIN32
#define IS_PATHSEP(x) (x == '/' || x == '\\')
- if (strlen(path) < 3) return 0;
- return (isalpha(path[0]) && path[1] == ':' && IS_PATHSEP(path[2]));
+ if (isalpha(path[0]))
+ return (strlen(path) > 2 && path[1] == ':' && IS_PATHSEP(path[2]));
+ else
+ return (IS_PATHSEP(path[0]) && IS_PATHSEP(path[1]));
#undef IS_PATHSEP
#else
return (path[0] == '/');