Skip to content

Commit

Permalink
Unlock _newlib_fd_mutex even when fd_to_scefd is full, fixes #8
Browse files Browse the repository at this point in the history
  • Loading branch information
xyzz authored and frangarcj committed Jul 22, 2021
1 parent a0ddc7e commit c6aa9c3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions newlib/libc/sys/vita/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,16 @@ _open_r(struct _reent *reent, const char *file, int flags, int mode)
found = i;
break;
}
if (!found)
goto fail;
if (!found) {
sceKernelUnlockLwMutex(_newlib_fd_mutex, 1);
sceIoClose(ret);
reent->_errno = EMFILE;
return -1;
}
fd_to_scefd[found] = ret;
sceKernelUnlockLwMutex(_newlib_fd_mutex, 1);
reent->_errno = 0;
return found;
fail:
reent->_errno = EMFILE;
return -1;
}

_ssize_t
Expand Down

0 comments on commit c6aa9c3

Please sign in to comment.