diff --git a/tasks/fs0/include/path.h b/tasks/fs0/include/path.h index ea6ad52..92a5c5d 100644 --- a/tasks/fs0/include/path.h +++ b/tasks/fs0/include/path.h @@ -23,7 +23,6 @@ struct pathdata { struct list_head list; struct vnode *vstart; - int root; }; struct pathcomp { diff --git a/tasks/fs0/src/syscalls.c b/tasks/fs0/src/syscalls.c index 2d93c35..e6e50b1 100644 --- a/tasks/fs0/src/syscalls.c +++ b/tasks/fs0/src/syscalls.c @@ -136,6 +136,23 @@ int sys_open(l4id_t sender, const char *pathname, int flags, unsigned int mode) int sys_close(l4id_t sender, int fd) { + struct tcb *task; + + /* Get the task */ + BUG_ON(!(task = find_task(sender))); + + /* Validate file descriptor */ + if (fd < 0 || fd > TASK_OFILES_MAX) { + l4_ipc_return(-EBADF); + return 0; + } + if (!task->fd[fd]) { + l4_ipc_return(-EBADF); + return 0; + } + + /* Finish I/O on file */ + return 0; } diff --git a/tasks/fs0/src/vfs.c b/tasks/fs0/src/vfs.c index 9afde6a..bf9396c 100644 --- a/tasks/fs0/src/vfs.c +++ b/tasks/fs0/src/vfs.c @@ -66,7 +66,7 @@ struct vnode *vfs_lookup_bypath(struct pathdata *pdata) * This does vfs cache + fs lookup. */ BUG_ON(list_empty(&pdata->list)); - firstcomp = pathdata_next_component(pdata); + firstcomp = pathdata_next_component(pdata); return pdata->vstart->ops.lookup(pdata->vstart, pdata, firstcomp); }