mirror of
https://github.com/libuv/libuv
synced 2025-03-28 21:13:16 +00:00
win, fs: mkdir really return UV_EINVAL for invalid names
Makes uv_fs_mkdir return UV_EINVAL for invalid directory names instead of UV_ENOENT. Refs: https://github.com/nodejs/node/issues/31177 PR-URL: https://github.com/libuv/libuv/pull/2601 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
parent
e756294295
commit
dd8662b6d2
@ -1218,7 +1218,8 @@ void fs__mkdir(uv_fs_t* req) {
|
||||
SET_REQ_RESULT(req, 0);
|
||||
} else {
|
||||
SET_REQ_WIN32_ERROR(req, GetLastError());
|
||||
if (req->sys_errno_ == ERROR_INVALID_NAME)
|
||||
if (req->sys_errno_ == ERROR_INVALID_NAME ||
|
||||
req->sys_errno_ == ERROR_DIRECTORY)
|
||||
req->result = UV_EINVAL;
|
||||
}
|
||||
}
|
||||
|
@ -4437,6 +4437,7 @@ TEST_IMPL(fs_invalid_mkdir_name) {
|
||||
loop = uv_default_loop();
|
||||
r = uv_fs_mkdir(loop, &req, "invalid>", 0, NULL);
|
||||
ASSERT(r == UV_EINVAL);
|
||||
ASSERT_EQ(UV_EINVAL, uv_fs_mkdir(loop, &req, "test:lol", 0, NULL));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user