Temporary and autosave files do not neccessarily have the correct
permissions set to replace existing project files. This updates the
permissions to match the existing values where possible
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13574
(cherry picked from commit 48ecd742eb)
Trying to squeeze out some kind of gain by informing the OS we will read a file sequentially.
In particular our FILE_LINE_READER just uses fgetc until the end