packages/s3ql: correctly determine buffer length when pre-seeked
This commit is contained in:
parent
d5c85b6a7c
commit
b680f81e69
1 changed files with 26 additions and 0 deletions
26
patches/base/s3ql/s3c-accurate-length.patch
Normal file
26
patches/base/s3ql/s3c-accurate-length.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
commit 1edbbcf08d5701ea38f13fca7491418318aebca9
|
||||
Author: Max <max@privatevoid.net>
|
||||
Date: Fri Jun 7 23:31:08 2024 +0200
|
||||
|
||||
accurate length
|
||||
|
||||
diff --git a/src/s3ql/backends/s3c.py b/src/s3ql/backends/s3c.py
|
||||
index 2995ca4f..3c3c79ab 100644
|
||||
--- a/src/s3ql/backends/s3c.py
|
||||
+++ b/src/s3ql/backends/s3c.py
|
||||
@@ -387,9 +387,13 @@ class Backend(AbstractBackend):
|
||||
'''
|
||||
|
||||
off = fh.tell()
|
||||
+ fh.seek(0, os.SEEK_END)
|
||||
+ actual_len = fh.tell() - off
|
||||
+ fh.seek(off, os.SEEK_SET)
|
||||
if len_ is None:
|
||||
- fh.seek(0, os.SEEK_END)
|
||||
- len_ = fh.tell()
|
||||
+ len_ = actual_len
|
||||
+ else:
|
||||
+ len_ = min(len_, actual_len)
|
||||
return self._write_fh(key, fh, off, len_, metadata or {})
|
||||
|
||||
@retry
|
Loading…
Reference in a new issue