libc: io: implement file io buffering and internal locking for concurrency
This commit is contained in:
@@ -15,10 +15,13 @@ int fclose(struct __opaque_file *stream)
|
||||
|
||||
close(stream->f_fd);
|
||||
|
||||
if (stream->f_buf) {
|
||||
free(stream->f_buf);
|
||||
if (stream->f_buf.buf_ptr) {
|
||||
free(stream->f_buf.buf_ptr);
|
||||
}
|
||||
|
||||
if (!(stream->f_flags & FILE_STATIC)) {
|
||||
free(stream);
|
||||
}
|
||||
|
||||
free(stream);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user