diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_filedesc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/kern_filedesc.c b/sys/kern/kern_filedesc.c index b95d123..7e65d77 100644 --- a/sys/kern/kern_filedesc.c +++ b/sys/kern/kern_filedesc.c @@ -242,6 +242,10 @@ write(int fd, const void *buf, size_t count) } desc = fd_from_fdnum(td, fd); + if (desc == NULL) { + return -EBADF; + } + if (desc->oflag != O_WRONLY && desc->oflag != O_WRONLY) { ret = -EACCES; goto cleanup; |