From e179bd1b43f692da5203e3b738b8d6cf221c89ff Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 14 Jun 2018 11:13:47 -0400 Subject: [PATCH] unix: set errno in uv_fs_copyfile() When the specific value of -1 is returned, uv__fs_work() uses the value of errno. This commit sets errno in uv__fs_copyfile(). Fixes: https://github.com/nodejs/node/issues/21329 PR-URL: https://github.com/libuv/libuv/pull/1881 Reviewed-By: Santiago Gimeno Reviewed-By: Ben Noordhuis --- src/unix/fs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/unix/fs.c b/src/unix/fs.c index 66fae37e..fcbc6786 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -929,7 +929,11 @@ out: } } - return result; + if (result == 0) + return 0; + + errno = UV__ERR(result); + return -1; #endif }