From 7231e172c3c1bd3259b967eb6ce197c7cc4966c2 Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Tue, 2 Apr 1996 14:19:35 +0000 Subject: (netfs_S_io_write): Verify that the user has the file open for writing. --- libnetfs/io-write.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libnetfs') 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, -- cgit v1.2.3