diff options
| author | Stefan Boberg <[email protected]> | 2026-04-16 20:42:09 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2026-04-16 20:42:09 +0200 |
| commit | f773ec3ecbfa34c5cac8597f80fb4afa54e1cf6a (patch) | |
| tree | 3a55b03cf97e94c30423cb4fb796dac4552e9473 /src/zenhttp/httpserver.cpp | |
| parent | Validate sizes and check errors in IoBufferBuilder::MakeFromFile (diff) | |
| download | archived-zen-f773ec3ecbfa34c5cac8597f80fb4afa54e1cf6a.tar.xz archived-zen-f773ec3ecbfa34c5cac8597f80fb4afa54e1cf6a.zip | |
Handle POSIX short writes in FileCasStrategy chunk write loop
The POSIX chunk-write path in FileCasStrategy::WriteChunk only treated
write() == -1 as failure. A partial write (0 < Written < Size) was
silently ignored and the outer loop advanced its cursor by the requested
byte count, leaving a hole in the on-disk chunk.
write() is allowed to return fewer bytes than requested on a regular
file (e.g. signal interrupt mid-syscall, filesystem-specific limits).
It is also allowed to fail with EINTR before making any progress. Both
cases would produce a truncated shard file whose contents no longer
match its IoHash, surfacing later as a hash mismatch on read or as
silently corrupt data depending on the code path.
Loop until all bytes are written, retry on EINTR, and treat a zero
return with bytes still pending as an error.
Diffstat (limited to 'src/zenhttp/httpserver.cpp')
0 files changed, 0 insertions, 0 deletions