The code was checking the total number of bytes written and the total number expected to be written.
If both numbers are the same, then this cannot be an error.
size = fwrite(buffer.string, file.byte_size, buffer.used, file.file);
- if (size <= buffer.used * file.byte_size) {
+ if (size < buffer.used * file.byte_size) {
return f_file_write_error;
}
size = fwrite(buffer.string + position.start, file.byte_size, total, file.file);
- if (size <= total * file.byte_size) {
+ if (size < total * file.byte_size) {
return f_file_write_error;
}