win: allow directory symlinks to be created in a non-elevated context
PR-URL: https://github.com/libuv/libuv/pull/1706 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
685059bf79
commit
dcd9b3cb27
@ -1785,7 +1785,7 @@ static void fs__symlink(uv_fs_t* req) {
|
||||
}
|
||||
|
||||
if (req->fs.info.file_flags & UV_FS_SYMLINK_DIR)
|
||||
flags = SYMBOLIC_LINK_FLAG_DIRECTORY;
|
||||
flags = SYMBOLIC_LINK_FLAG_DIRECTORY | uv__file_symlink_usermode_flag;
|
||||
else
|
||||
flags = uv__file_symlink_usermode_flag;
|
||||
|
||||
|
||||
@ -1861,7 +1861,7 @@ TEST_IMPL(fs_symlink) {
|
||||
}
|
||||
|
||||
|
||||
TEST_IMPL(fs_symlink_dir) {
|
||||
int test_symlink_dir_impl(int type) {
|
||||
uv_fs_t req;
|
||||
int r;
|
||||
char* test_dir;
|
||||
@ -1895,8 +1895,12 @@ TEST_IMPL(fs_symlink_dir) {
|
||||
test_dir = "test_dir";
|
||||
#endif
|
||||
|
||||
r = uv_fs_symlink(NULL, &req, test_dir, "test_dir_symlink",
|
||||
UV_FS_SYMLINK_JUNCTION, NULL);
|
||||
r = uv_fs_symlink(NULL, &req, test_dir, "test_dir_symlink", type, NULL);
|
||||
if (type == UV_FS_SYMLINK_DIR && (r == UV_ENOTSUP || r == UV_EPERM)) {
|
||||
uv_fs_req_cleanup(&req);
|
||||
RETURN_SKIP("this version of Windows doesn't support unprivileged "
|
||||
"creation of directory symlinks");
|
||||
}
|
||||
fprintf(stderr, "r == %i\n", r);
|
||||
ASSERT(r == 0);
|
||||
ASSERT(req.result == 0);
|
||||
@ -2005,6 +2009,13 @@ TEST_IMPL(fs_symlink_dir) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
TEST_IMPL(fs_symlink_dir) {
|
||||
return test_symlink_dir_impl(UV_FS_SYMLINK_DIR);
|
||||
}
|
||||
|
||||
TEST_IMPL(fs_symlink_junction) {
|
||||
return test_symlink_dir_impl(UV_FS_SYMLINK_JUNCTION);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
TEST_IMPL(fs_non_symlink_reparse_point) {
|
||||
|
||||
@ -289,6 +289,7 @@ TEST_DECLARE (fs_realpath)
|
||||
TEST_DECLARE (fs_symlink)
|
||||
TEST_DECLARE (fs_symlink_dir)
|
||||
#ifdef _WIN32
|
||||
TEST_DECLARE (fs_symlink_junction)
|
||||
TEST_DECLARE (fs_non_symlink_reparse_point)
|
||||
#endif
|
||||
TEST_DECLARE (fs_utime)
|
||||
@ -817,6 +818,7 @@ TASK_LIST_START
|
||||
TEST_ENTRY (fs_symlink)
|
||||
TEST_ENTRY (fs_symlink_dir)
|
||||
#ifdef _WIN32
|
||||
TEST_ENTRY (fs_symlink_junction)
|
||||
TEST_ENTRY (fs_non_symlink_reparse_point)
|
||||
#endif
|
||||
TEST_ENTRY (fs_stat_missing_path)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user