unix: return UV_ENOTSUP on FICLONE_FORCE failure
Instead of returning whatever error is provided by the underlying platform, use UV_ENOTSUP. Fixes: https://github.com/libuv/libuv/issues/1862 PR-URL: https://github.com/libuv/libuv/pull/1863 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
parent
0c28363059
commit
6103d294f7
@ -865,9 +865,11 @@ static ssize_t uv__fs_copyfile(uv_fs_t* req) {
|
|||||||
/* If an error occurred that the sendfile fallback also won't handle, or
|
/* If an error occurred that the sendfile fallback also won't handle, or
|
||||||
this is a force clone then exit. Otherwise, fall through to try using
|
this is a force clone then exit. Otherwise, fall through to try using
|
||||||
sendfile(). */
|
sendfile(). */
|
||||||
if ((errno != ENOTTY && errno != EOPNOTSUPP && errno != EXDEV) ||
|
if (errno != ENOTTY && errno != EOPNOTSUPP && errno != EXDEV) {
|
||||||
req->flags & UV_FS_COPYFILE_FICLONE_FORCE) {
|
err = UV__ERR(errno);
|
||||||
err = -errno;
|
goto out;
|
||||||
|
} else if (req->flags & UV_FS_COPYFILE_FICLONE_FORCE) {
|
||||||
|
err = UV_ENOTSUP;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -179,7 +179,7 @@ TEST_IMPL(fs_copyfile) {
|
|||||||
unlink(dst);
|
unlink(dst);
|
||||||
r = uv_fs_copyfile(NULL, &req, fixture, dst, UV_FS_COPYFILE_FICLONE_FORCE,
|
r = uv_fs_copyfile(NULL, &req, fixture, dst, UV_FS_COPYFILE_FICLONE_FORCE,
|
||||||
NULL);
|
NULL);
|
||||||
ASSERT(r == 0 || r == UV_ENOSYS || r == UV_ENOTSUP || r == UV_ENOTTY);
|
ASSERT(r == 0 || r == UV_ENOSYS || r == UV_ENOTSUP);
|
||||||
|
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
handle_result(&req);
|
handle_result(&req);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user