Skip to content

Commit 6113f53

Browse files
committed
fixup! [LibOS] Update syscall fchmodat(), mmap(), readv() error codes to align with man page
Signed-off-by: Erica Fu <[email protected]>
1 parent 1f8a7e1 commit 6113f53

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

libos/src/sys/libos_wrappers.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
* notably affects pipes. */
1717

1818
long libos_syscall_readv(unsigned long fd, struct iovec* vec, unsigned long vlen) {
19-
size_t arr_size;
20-
if ((int)fd < 0)
19+
struct libos_handle* hdl = get_fd_handle(fd, NULL, NULL);
20+
if (!hdl)
2121
return -EBADF;
22+
23+
size_t arr_size;
2224
if (__builtin_mul_overflow(sizeof(*vec), vlen, &arr_size))
2325
return -EINVAL;
2426
if (!is_user_memory_readable(vec, arr_size))
@@ -33,10 +35,6 @@ long libos_syscall_readv(unsigned long fd, struct iovec* vec, unsigned long vlen
3335
}
3436
}
3537

36-
struct libos_handle* hdl = get_fd_handle(fd, NULL, NULL);
37-
if (!hdl)
38-
return -EBADF;
39-
4038
maybe_lock_pos_handle(hdl);
4139

4240
int ret = 0;

0 commit comments

Comments
 (0)