On Sun, Dec 06, 2020 at 05:37:46PM +0000, Colin Watson wrote:
I don't know why Dimitri chose to explicitly remove the new files first
rather than just renaming over the top and then removing any leftovers
at the end; that seems unnecessarily risky. Though this is code that's
apparently supposed to work on Windows as well, and the MoveFile
function that's used to implement grub_util_rename there requires the
destination file not to exist (sigh), so maybe it had something to do
with that.
Incidentally, if this is actually the reason, then I think this would be
a viable replacement:
ret = !MoveFileEx (windows_from, windows_to, MOVEFILE_REPLACE_EXISTING);
Not that I really speak the Windows API ...
--
Colin Watson (he/him) [cjwatson@ubuntu.com]