Skip to content

Commit

Permalink
unix: use fchmod() in uv_fs_copyfile()
Browse files Browse the repository at this point in the history
This commit introduces fchmod() in uv_fs_copyfile() to set the
mode of the destination file.
  • Loading branch information
cjihrig committed Sep 13, 2017
1 parent 832ab90 commit 4b55962
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/unix/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ static ssize_t uv__fs_copyfile(uv_fs_t* req) {
&fs_req,
req->new_path,
dst_flags,
statsbuf.st_mode,
0,
NULL);
uv_fs_req_cleanup(&fs_req);

Expand All @@ -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) {
Expand Down

0 comments on commit 4b55962

Please sign in to comment.