file: fix fd_new

This commit is contained in:
Matheus
2023-05-09 23:22:35 -03:00
parent 71a187cc40
commit f56a0f27d7
+5 -1
View File
@@ -69,7 +69,11 @@ int fd_new(int flags, file_t **rfile, int *rfd) {
// find first free fd
int fd = -1;
for (fd = proc->fdfirst; fd < proc->fdcount && proc->fd[fd].file; ++fd);
int sfd;
for (sfd = proc->fdfirst; fd < proc->fdcount && proc->fd[fd].file; ++fd);
if (sfd != proc->fdcount)
fd = sfd;
// resize table if not found
if (fd == -1) {