1
0
mirror of https://gitlab.com/80486DX2-66/gists synced 2025-05-31 08:31:41 +05:30

reverse-ramdisk.c: flush file buffer on each write

This commit is contained in:
2023-12-27 21:30:42 +03:00
parent bb43a5dc53
commit eae82bcceb

View File

@@ -9,7 +9,7 @@ production purposes.
GCC/Clang/TCC: Compile with -DTEST to set macro TEST as defined, with -DDEBUG
to enable debug mode
To-Do: error handling on line 179, function fread()
To-Do: error handling on line 184, function fread()
*/
#include <errno.h>
@@ -154,6 +154,11 @@ int tf_write(int ID, size_t offset, void* data, size_t data_size) {
if (bytes_written != data_size)
return -1;
if (fdatasync(file) == -1) {
line_fail(-1);
return -1;
}
return 0;
}