unix: use fchmod() in uv_fs_copyfile()

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 <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
cjihrig 2017-09-13 14:14:25 -04:00
parent 6ad1e81547
commit eaf25ae3eb
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -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) {