Perform some code cleanup

This commit is contained in:
Justine Tunney 2022-10-04 23:32:16 -07:00
parent 174d288e66
commit fe3216e961
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
14 changed files with 803 additions and 312 deletions

View file

@ -46,8 +46,8 @@
* @restartable
*/
ssize_t readv(int fd, const struct iovec *iov, int iovlen) {
int i;
ssize_t rc;
if (fd >= 0 && iovlen >= 0) {
if (IsAsan() && !__asan_is_valid_iov(iov, iovlen)) {
rc = efault();
@ -67,9 +67,12 @@ ssize_t readv(int fd, const struct iovec *iov, int iovlen) {
} else {
rc = sys_readv_nt(g_fds.p + fd, iov, iovlen);
}
} else if (fd < 0) {
rc = ebadf();
} else {
rc = einval();
}
#if defined(SYSDEBUG) && _DATATRACE
if (UNLIKELY(__strace > 0)) {
if (rc == -1 && errno == EFAULT) {
@ -81,5 +84,6 @@ ssize_t readv(int fd, const struct iovec *iov, int iovlen) {
}
}
#endif
return rc;
}