diff options
Diffstat (limited to 'src/kernel/user')
-rw-r--r-- | src/kernel/user/vfs.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/kernel/user/vfs.c b/src/kernel/user/vfs.c index fa226f8..0cb7f3f 100644 --- a/src/kernel/user/vfs.c +++ b/src/kernel/user/vfs.c @@ -497,6 +497,8 @@ void unref_file(fs_handle_t *file) { } size_t file_read(fs_handle_t *f, size_t offset, size_t len, char* buf) { + if (len == 0) return 0; + if (!(f->mode & FM_READ)) return 0; if (f->node->ops->read == 0) return 0; @@ -505,6 +507,8 @@ size_t file_read(fs_handle_t *f, size_t offset, size_t len, char* buf) { } size_t file_write(fs_handle_t *f, size_t offset, size_t len, const char* buf) { + if (len == 0) return 0; + if (!(f->mode & FM_WRITE)) return 0; if (f->node->ops->write == 0) return 0; |