diff options
author | NRK <nrk@disroot.org> | 2023-05-07 23:36:17 +0200 |
---|---|---|
committer | NRK <nrk@disroot.org> | 2023-10-01 13:02:35 +0200 |
commit | 2093f36661194f6f820c1233ff8857656a4d1dfe (patch) | |
tree | 0dd8fb0e55f53223138fa44a8d96c5c93d3b9e35 /image.c | |
parent | 3659361e76c5c994bee3467787c00e89780cccbc (diff) | |
download | nsxiv-2093f36661194f6f820c1233ff8857656a4d1dfe.tar.zst |
make thumbnail caching safer against concurrent writes
by writing to a tmpfile first, and then renaming it to the desired
target - multiple nsxiv instances writing thumbnail at the same time are
guaranteed not to stomp over one another.
rename() is guaranteed to be atomic by POSIX. however, it can fail with
EXDEV if both the files don't reside in the same filesystem. and so we
cannot make the tmpfile something like "/tmp/nsxiv-XXXXXX".
instead, create the tmpfile inside the cache_dir to reduce chances of
EXDEV occuring.
Diffstat (limited to 'image.c')
0 files changed, 0 insertions, 0 deletions