From eaf25ae3eb8fe567b8be15614996b112dbf5c11b Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 13 Sep 2017 14:14:25 -0400 Subject: [PATCH] unix: use fchmod() in uv_fs_copyfile() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit introduces fchmod() in uv_fs_copyfile() to set the mode of the destination file. Refs: https://github.com/nodejs/node/issues/15394 PR-URL: https://github.com/libuv/libuv/pull/1547 Reviewed-By: Ben Noordhuis Reviewed-By: Saúl Ibarra Corretgé --- src/unix/fs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/unix/fs.c b/src/unix/fs.c index 5a172cc7..a6366255 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -828,6 +828,11 @@ static ssize_t uv__fs_copyfile(uv_fs_t* req) { goto out; } + if (fchmod(dstfd, statsbuf.st_mode) == -1) { + err = -errno; + goto out; + } + bytes_to_send = statsbuf.st_size; in_offset = 0; while (bytes_to_send != 0) {