mirror of https://github.com/flysand7/ciabatta.git
Bug fix
This commit is contained in:
parent
7d43887438
commit
01394ae39a
|
@ -69,7 +69,7 @@ static void _file_untrack(FILE *stream) {
|
||||||
// Multithreaded access
|
// Multithreaded access
|
||||||
|
|
||||||
static inline void _file_lock_init(FILE *stream) {
|
static inline void _file_lock_init(FILE *stream) {
|
||||||
mtx_init(&stream->lock, mtx_recursive);
|
mtx_init(&stream->lock, mtx_plain);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _file_lock_destroy(FILE *stream) {
|
static inline void _file_lock_destroy(FILE *stream) {
|
||||||
|
@ -345,8 +345,9 @@ int fflush(FILE *stream) {
|
||||||
_file_lock(stream);
|
_file_lock(stream);
|
||||||
int res = 0;
|
int res = 0;
|
||||||
FileBuffer *buffer = &stream->buffer;
|
FileBuffer *buffer = &stream->buffer;
|
||||||
void *data = buffer->data;
|
if(buffer->written != 0) {
|
||||||
size_t size = buffer->written;
|
size_t size = buffer->written;
|
||||||
|
void *data = buffer->data;
|
||||||
DWORD bytes_written;
|
DWORD bytes_written;
|
||||||
BOOL ok = WriteFile(stream->handle, data, size, &bytes_written, NULL);
|
BOOL ok = WriteFile(stream->handle, data, size, &bytes_written, NULL);
|
||||||
if(!ok) {
|
if(!ok) {
|
||||||
|
@ -354,6 +355,7 @@ int fflush(FILE *stream) {
|
||||||
stream->eof = 1;
|
stream->eof = 1;
|
||||||
}
|
}
|
||||||
buffer->written = 0;
|
buffer->written = 0;
|
||||||
|
}
|
||||||
_file_unlock(stream);
|
_file_unlock(stream);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue