mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-25 15:15:18 +01:00
Receiving a regular file over an existing symlink or hard link used to truncate and overwrite the file the link points to. Instead, write received files to a temporary file in the destination directory and atomically rename it into place once the transfer completes, as was already done for delta transfers. This also means interrupted transfers no longer leave truncated files behind. If the destination directory is not writable, fall back to writing in place, but only for regular files with a single link, so that no other file can be affected. Also use stat rather than lstat when deciding whether to use delta transfers, so that symlinks to large files can use them, and remove the temporary file of failed or aborted delta transfers. Closes #10713