aboutsummaryrefslogtreecommitdiff
path: root/libnetfs/io-write.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnetfs/io-write.c')
-rw-r--r--libnetfs/io-write.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libnetfs/io-write.c b/libnetfs/io-write.c
index 7e452ede..2ff9f0c5 100644
--- a/libnetfs/io-write.c
+++ b/libnetfs/io-write.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -34,6 +34,12 @@ netfs_S_io_write (struct protid *user,
return EOPNOTSUPP;
mutex_lock (&user->po->np->lock);
+ if ((user->po->openstat & O_WRITE) == 0)
+ {
+ mutex_unlock (&user->po->np->lock);
+ return EBADF;
+ }
+
*amount = datalen;
err = netfs_attempt_write (user->credential, user->po->np,
offset == -1 ? user->po->filepointer : offset,