fd wasn't returned in reorganised sys_open. Fixed.

This commit is contained in:
Bahadir Balban
2008-04-19 00:55:11 +01:00
parent 8c4c436925
commit ce26835968
3 changed files with 22 additions and 7 deletions

View File

@@ -129,6 +129,7 @@ int sys_open(l4id_t sender, const char *pathname, int flags, unsigned int mode)
/* Get a new fd */
BUG_ON((fd = id_new(task->fdpool)) < 0);
retval = fd;
/* Assign the new fd with the vnode's number */
task->fd[fd] = v->vnum;
@@ -339,6 +340,11 @@ int sys_readdir(l4id_t sender, int fd, void *buf, int count)
return 0;
}
if (fd < 0 || fd > TASK_OFILES_MAX) {
l4_ipc_return(-EBADF);
return 0;
}
/* Convert fd to vnum. */
BUG_ON((vnum = t->fd[fd]) < 0);