mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
syscalls/shutdown: add argument validity check
This commit is contained in:
@@ -13,8 +13,13 @@ syscallret_t syscall_shutdown(context_t *, int fd, int how) {
|
|||||||
.ret = -1
|
.ret = -1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (how > 2) {
|
||||||
|
ret.errno = EINVAL;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
++how; // convert to internal meaning
|
++how; // convert to internal meaning
|
||||||
|
|
||||||
file_t *file = fd_get(fd);
|
file_t *file = fd_get(fd);
|
||||||
if (file == NULL) {
|
if (file == NULL) {
|
||||||
ret.errno = EBADF;
|
ret.errno = EBADF;
|
||||||
|
|||||||
Reference in New Issue
Block a user