Repository navigation
CI Report:
https://ci-tests.linuxserver.io/linuxserver/tvheadend/a87be591-ls287/index.html
LinuxServer Changes:
Full Changelog: 5ce3ff63-ls286...a87be591-ls287
Remote Changes:
imagecache: do not replace a cached image when the write failed
imagecache_new_contents() ignored the result of fwrite and of fclose and
carried on regardless. On ENOSPC or EIO it unlinked the image that was still
valid, stored the sha1 of the content it meant to write, renamed the partial
file into its place, and persisted that metadata.
The check at the top of the same function then makes the damage permanent: the
stored sha1 matches the content that was supposed to be there, so the next
fetch of that image returns early as "identical" and never rewrites it. The
entry stays corrupt while advertising itself as current, and nothing repairs it
short of deleting the file or clearing the cache.
Check both calls and leave the cache as it was when either fails -- the
temporary file is removed, the previous image and its sha1 are untouched, and a
non-zero return reaches the caller. The "dsize &&" keeps the legitimate
zero-length case, where fwrite returns 0 without error, and fclose is checked
too, since a deferred flush error surfaces there and not before.
Fixes #2322
Assisted-by: Claude Opus 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01QEH1b4ASNYSrZFQnEeroj8