diff options
Diffstat (limited to 'stand/libsa/write.c')
-rw-r--r-- | stand/libsa/write.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/stand/libsa/write.c b/stand/libsa/write.c index 7d054e005cda..db82d7eaf4f6 100644 --- a/stand/libsa/write.c +++ b/stand/libsa/write.c @@ -69,10 +69,11 @@ __FBSDID("$FreeBSD$"); ssize_t write(int fd, const void *dest, size_t bcount) { - struct open_file *f = &files[fd]; + struct open_file *f; size_t resid; - if ((unsigned)fd >= SOPEN_MAX || !(f->f_flags & F_WRITE)) { + f = fd2open_file(fd); + if (f == NULL || !(f->f_flags & F_WRITE)) { errno = EBADF; return (-1); } |