replace_file_start: On error, ensure that the appropriate errno value is held