diff options
Diffstat (limited to 'sys/lib/libsa/fchmod.c')
-rw-r--r-- | sys/lib/libsa/fchmod.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/lib/libsa/fchmod.c b/sys/lib/libsa/fchmod.c index 7d9bc9cac36..f6252ca9e56 100644 --- a/sys/lib/libsa/fchmod.c +++ b/sys/lib/libsa/fchmod.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fchmod.c,v 1.1 2019/08/03 15:22:17 deraadt Exp $ */ +/* $OpenBSD: fchmod.c,v 1.2 2021/12/01 17:25:35 kettenis Exp $ */ /* $NetBSD: stat.c,v 1.3 1994/10/26 05:45:07 cgd Exp $ */ /*- @@ -53,6 +53,11 @@ fchmod(int fd, mode_t m) errno = EOPNOTSUPP; return (-1); } + /* writing is broken or unsupported */ + if (f->f_flags & F_NOWRITE) { + errno = EOPNOTSUPP; + return (-1); + } errno = (f->f_ops->fchmod)(f, m); return (0); |