https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106296
Bug ID: 106296 Summary: Consider using fsync or fdatasync in filesystem::copy_file Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- Writing the file to disk might be slow and could be interrupted by a signal. If we don't flush explicitly, it will happen when closing the file descriptor, but if that's interrupted by a signal we don't know if the file was closed or not. Consider using fsync to flush the data explicitly, looping on EINTR, so that there's nothing more to do when closing the file.