ctc-oss / fapolicy-analyzer

Tools to assist with the configuration and management of fapolicyd.
https://ctc-oss.github.io/fapolicy-analyzer
GNU General Public License v3.0
12 stars 5 forks source link

Try harder to create rules backup #967

Closed jw3 closed 9 months ago

jw3 commented 9 months ago

Add a fallback for when a rename does not succeed.

In the case where tempdir is on a different filesystem the std::fs::rename call will fail.

This function will return an error in the following situations, but is not limited to just these cases:

  - from does not exist.
  - The user lacks permissions to view contents.
  - from and to are on separate filesystems.

https://doc.rust-lang.org/std/fs/fn.rename.html

This commit updates the logic to fallback to a copy and delete.

Closes #965