summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-04-02 14:19:35 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-04-02 14:19:35 +0000
commit7231e172c3c1bd3259b967eb6ce197c7cc4966c2 (patch)
tree26e8bd48302485104656180f1f42d02c9872d0ce
parent56cd00a8f29eef06941758fb07a27a42cbbfaca5 (diff)
(netfs_S_io_write): Verify that the user has the file open for
writing.
-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,