summaryrefslogtreecommitdiff
path: root/libnetfs/io-write.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnetfs/io-write.c')
-rw-r--r--libnetfs/io-write.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/libnetfs/io-write.c b/libnetfs/io-write.c
index 26c3c297..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,17 +36,14 @@ 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)