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.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/libnetfs/io-write.c b/libnetfs/io-write.c
index c299d15c..c4423dab 100644
--- a/libnetfs/io-write.c
+++ b/libnetfs/io-write.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -36,22 +36,19 @@ netfs_S_io_write (struct protid *user,
if (!user)
return EOPNOTSUPP;
- np = user->po->np;
-
- mutex_lock (&np->lock);
if ((user->po->openstat & O_WRITE) == 0)
- {
- mutex_unlock (&np->lock);
- return EBADF;
- }
+ return EBADF;
*amount = datalen;
+ np = user->po->np;
+ mutex_lock (&np->lock);
+
if (off == -1)
{
if (user->po->openstat & O_APPEND)
{
- err = netfs_validate_stat (np, user->credential);
+ err = netfs_validate_stat (np, user->user);
if (err)
{
mutex_unlock (&np->lock);
@@ -62,7 +59,7 @@ netfs_S_io_write (struct protid *user,
off = user->po->filepointer;
}
- err = netfs_attempt_write (user->credential, np, off, amount, data);
+ err = netfs_attempt_write (user->user, np, off, amount, data);
if (offset == -1 && !err)
user->po->filepointer += *amount;
mutex_unlock (&np->lock);