Permalink
Browse files

windows: don't inhibit reparse behavior when non-symlink is encountered

This fixes the issue that a mount point would be treated as a
symlink, but readlink would subsequently return an NT namespaced
path that is unusable for many purposes.

This also pre-emptively fixes the problems that would arise when
an user has a reparse point whose tag is neither
IO_REPARSE_TAG_MOUNT_POINT nor IO_REPARSE_TAG_SYMLINK.

Finally uv_lstat() will now return the correct length in st_size.
Previously the length was computed incorrectly for relative
symlinks, and those that had non-ascii characters in their target.
  • Loading branch information...
1 parent 1b68434 commit 4a88b3b4b72de79d8a6f3107a200f6f960f475a7 @piscisaureus piscisaureus committed Jun 28, 2012
Showing with 168 additions and 146 deletions.
  1. +2 −0 src/win/error.c
  2. +166 −146 src/win/fs.c
View
@@ -83,6 +83,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case ERROR_SIGNAL_REFUSED: return UV_EIO;
case ERROR_FILE_NOT_FOUND: return UV_ENOENT;
case ERROR_INVALID_NAME: return UV_ENOENT;
+ case ERROR_INVALID_REPARSE_DATA: return UV_ENOENT;
case ERROR_MOD_NOT_FOUND: return UV_ENOENT;
case ERROR_PATH_NOT_FOUND: return UV_ENOENT;
case ERROR_ACCESS_DENIED: return UV_EPERM;
@@ -111,6 +112,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case ERROR_OPERATION_ABORTED: return UV_EINTR;
case WSAEINTR: return UV_EINTR;
case ERROR_INVALID_DATA: return UV_EINVAL;
+ case ERROR_SYMLINK_NOT_SUPPORTED: return UV_EINVAL;
case WSAEINVAL: return UV_EINVAL;
case ERROR_CANT_RESOLVE_FILENAME: return UV_ELOOP;
case ERROR_TOO_MANY_OPEN_FILES: return UV_EMFILE;
Oops, something went wrong.

1 comment on commit 4a88b3b

Member

piscisaureus commented on 4a88b3b Jun 28, 2012

@bnoordhuis said: lmg

Please sign in to comment.