vfs: zero fdesc struct on initialization
Fixes a bug where using cat on a file twice would fail, because the previous file descriptor slab position would be used again, with the same `pos` value, which was EOF.
This commit is contained in:
parent
ca8e1521df
commit
fbc70ddf7b
1 changed files with 2 additions and 0 deletions
2
fs/vfs.c
2
fs/vfs.c
|
|
@ -53,6 +53,8 @@ int open(const char *pathname, int flags)
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memset(fd, 0, sizeof(struct file_descriptor));
|
||||
|
||||
/* find the file */
|
||||
int result = rootfs->ops.open(rootfs, &fd->file, pathname);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue