summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_descrip.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index db41fbd29841..fe73aefe3cab 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1496,7 +1496,7 @@ _fget(struct thread *td, int fd, struct file **fpp, int flags, int hold)
(fp = fdp->fd_ofiles[fd]) == NULL ||
fp->f_ops == &badfileops) {
FILEDESC_UNLOCK(fdp);
- return(EBADF);
+ return(fd < 0 ? EINVAL : EBADF);
}
/*