diff --git a/src/copyfile.c b/src/copyfile.c index a6e7ea2..8c5463b 100644 --- a/src/copyfile.c +++ b/src/copyfile.c @@ -175,7 +175,7 @@ ssize_t copyfile(char *src, char *dst, int len, int opt) goto exit; } - out = open(dst, O_WRONLY | O_CREAT | O_TRUNC, fmode(src)); + out = open(dst, O_WRONLY | O_CREAT | O_TRUNC, st.st_mode); if (out < 0) { close(in); saved_errno = errno;