Under linux, the only time (in common use) the filename is relevant is when it is opened or stat()-ed.
The open() call returns a file descriptor, so the file may be renamed (within the same filesystem aka "drive") or even deleted. The application will not mind.
However, if the application uses the paradigm: open-read-close then open-write-close it will save to the old filename regardless of what has happened to the previous copy.
Neither scenario will prevent a file being replaced - even a system library - though the correct method is always:
unlink()-open()-write()-close()
A deleted file will still exist on disk until the last open file descriptor to it is closed. A very simple and elegant solution.
But this is generally wrong
open()-trunc()-write()-close() which will confuse applications that have the file open.
Cheers
Tim