| 599 | } |
| 600 | |
| 601 | void FileCommit(FILE *fileout) |
| 602 | { |
| 603 | fflush(fileout); // harmless if redundantly called |
| 604 | #ifdef WIN32 |
| 605 | HANDLE hFile = (HANDLE)_get_osfhandle(_fileno(fileout)); |
| 606 | FlushFileBuffers(hFile); |
| 607 | #else |
| 608 | #if defined(__linux__) || defined(__NetBSD__) |
| 609 | fdatasync(fileno(fileout)); |
| 610 | #elif defined(__APPLE__) && defined(F_FULLFSYNC) |
| 611 | fcntl(fileno(fileout), F_FULLFSYNC, 0); |
| 612 | #else |
| 613 | fsync(fileno(fileout)); |
| 614 | #endif |
| 615 | #endif |
| 616 | } |
| 617 | |
| 618 | bool TruncateFile(FILE *file, unsigned int length) { |
| 619 | #if defined(WIN32) |
no outgoing calls
no test coverage detected