mirror of
https://gitlab.com/80486DX2-66/gists
synced 2025-01-26 09:11:54 +05:30
reverse-ramdisk.c: flush file buffer on each write
This commit is contained in:
parent
bb43a5dc53
commit
eae82bcceb
@ -9,7 +9,7 @@ production purposes.
|
|||||||
GCC/Clang/TCC: Compile with -DTEST to set macro TEST as defined, with -DDEBUG
|
GCC/Clang/TCC: Compile with -DTEST to set macro TEST as defined, with -DDEBUG
|
||||||
to enable debug mode
|
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>
|
#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)
|
if (bytes_written != data_size)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (fdatasync(file) == -1) {
|
||||||
|
line_fail(-1);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user