diff --git a/src/unix/fs.c b/src/unix/fs.c index a45c95a17..4a9e8d9a1 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -1327,7 +1327,17 @@ static ssize_t uv__fs_copyfile(uv_fs_t* req) { if (futimens(dstfd, times) == -1) { err = UV__ERR(errno); +#ifdef __linux__ + /* futimens() on CIFS/SMB shares may fail with EPERM. Since preserving + * timestamps is best-effort, detect that condition and squelch the error. + */ + if (err == UV_EPERM && uv__is_cifs_or_smb(dstfd)) + err = 0; + else + goto out; +#else /* !__linux__ */ goto out; +#endif /* !__linux__ */ } /*