We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a09ff4d commit 5917a6bCopy full SHA for 5917a6b
Lib/shutil.py
@@ -214,6 +214,16 @@ def _fastcopy_sendfile(fsrc, fdst):
214
# ENODATA: In rare cases, sendfile() on Linux Lustre
215
# returns ENODATA.
216
_USE_CP_SENDFILE = False
217
+
218
+ dstpos = os.lseek(outfd, 0, os.SEEK_CUR)
219
+ if dstpos > 0:
220
+ # Some data has already been written but we use
221
+ # sendfile in a mode that does not update the
222
+ # input fd position when reading. Hence seek the
223
+ # input fd to the correct position before falling
224
+ # back on POSIX read/write method
225
+ os.lseek(infd, dstpos, os.SEEK_SET)
226
227
raise _GiveupOnFastCopy(err)
228
229
if err.errno == errno.ENOSPC: # filesystem is full
0 commit comments