1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 00:11:17 +02:00

Only use renameFile where needed

In most places the fallback to copying isn’t needed and can actually be
bad, so we’d rather not transparently fallback
This commit is contained in:
Théophane Hufschmitt 2022-04-13 14:19:42 +02:00
parent d71d9e9fbf
commit 90f9680733
3 changed files with 19 additions and 6 deletions

View file

@ -170,6 +170,15 @@ void replaceSymlink(const Path & target, const Path & link,
void renameFile(const Path & src, const Path & dst);
/**
* Similar to 'renameFile', but fallback to a copy+remove if `src` and `dst`
* are on a different filesystem.
*
* Beware that this might not be atomic because of the copy that happens behind
* the scenes
*/
void moveFile(const Path & src, const Path & dst);
/* Wrappers arount read()/write() that read/write exactly the
requested number of bytes. */