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:
Michael Shaw 2023-10-21 01:09:51 -04:00
commit fbc70ddf7b

View file

@ -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);