diff --git a/dcapi/common/util.c b/dcapi/common/util.c index b93027def2..370b488a2f 100644 --- a/dcapi/common/util.c +++ b/dcapi/common/util.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include #include @@ -28,6 +30,7 @@ int _DC_copyFile(const char *src, const char *dst) int sfd, dfd; ssize_t ret; char *buf; + struct stat s; buf = (char *)malloc(COPY_BUFSIZE); if (!buf) @@ -43,7 +46,8 @@ int _DC_copyFile(const char *src, const char *dst) free(buf); return -1; } - dfd = open(dst, O_WRONLY | O_CREAT | O_TRUNC); + fstat(sfd, &s); + dfd = open(dst, O_WRONLY | O_CREAT | O_TRUNC, s.st_mode); if (dfd == -1) { #if 0