diff options
Diffstat (limited to 'win32/file.c')
-rw-r--r-- | win32/file.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/win32/file.c b/win32/file.c index 46a7ec7d5d..3b18a36348 100644 --- a/win32/file.c +++ b/win32/file.c @@ -689,11 +689,15 @@ rb_readlink(VALUE path, rb_encoding *resultenc) ALLOCV_END(wpathbuf); if (e) { ALLOCV_END(wtmp); - rb_syserr_fail_path(rb_w32_map_errno(e), path); + if (e != -1) + rb_syserr_fail_path(rb_w32_map_errno(e), path); + else /* not symlink; maybe volume mount point */ + rb_syserr_fail_path(EINVAL, path); } enc = resultenc; cp = path_cp = code_page(enc); if (cp == INVALID_CODE_PAGE) cp = CP_UTF8; + len = lstrlenW(wbuf); str = append_wstr(rb_enc_str_new(0, 0, enc), wbuf, len, cp, path_cp, enc); ALLOCV_END(wtmp); return str; |