summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_descrip.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 28922d3..7cc2c12 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1983,8 +1983,7 @@ _fget(struct thread *td, int fd, struct file **fpp, int flags, int hold)
}
/*
- * Note: FREAD failure returns EBADF to maintain backwards
- * compatibility with what routines returned before.
+ * FREAD and FWRITE failure return EBADF as per POSIX.
*
* Only one flag, or 0, may be specified.
*/
@@ -1994,7 +1993,7 @@ _fget(struct thread *td, int fd, struct file **fpp, int flags, int hold)
}
if (flags == FWRITE && (fp->f_flag & FWRITE) == 0) {
FILEDESC_UNLOCK(fdp);
- return (EINVAL);
+ return (EBADF);
}
if (hold) {
fhold(fp);
OpenPOWER on IntegriCloud