aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/user
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2015-03-14 15:11:29 +0100
committerAlex Auvolat <alex@adnab.me>2015-03-14 15:11:29 +0100
commitf574c22f86d90f735107fda199bb5b4982cd9621 (patch)
tree981c8d3417465e1084eceab05c44bf1f8e4b2017 /src/kernel/user
parent51def2fc45d98b59be0413fcb9c25cbb0bbca211 (diff)
downloadkogata-f574c22f86d90f735107fda199bb5b4982cd9621.tar.gz
kogata-f574c22f86d90f735107fda199bb5b4982cd9621.zip
Fix write of null length to channel ; fix cat.
Diffstat (limited to 'src/kernel/user')
-rw-r--r--src/kernel/user/vfs.c4
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;