lib/fs: Unwrap mtimeFile, get fd the "correct" way (ref #6875) (#6877)

This commit is contained in:
Audrius Butkevicius
2020-08-07 07:47:48 +02:00
committed by GitHub
parent ff84f075d5
commit e9bb17307d
8 changed files with 337 additions and 157 deletions
+3 -1
View File
@@ -29,7 +29,9 @@ func copyRangeCopyFileRange(src, dst basicFile, srcOffset, dstOffset, size int64
// appropriately.
//
// Also, even if explicitly not stated, the same is true for dstOffset
n, err := unix.CopyFileRange(int(src.Fd()), &srcOffset, int(dst.Fd()), &dstOffset, int(size), 0)
n, err := withFileDescriptors(src, dst, func(srcFd, dstFd uintptr) (int, error) {
return unix.CopyFileRange(int(srcFd), &srcOffset, int(dstFd), &dstOffset, int(size), 0)
})
if n == 0 && err == nil {
return io.ErrUnexpectedEOF
}