summaryrefslogtreecommitdiff
path: root/nfs
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1997-04-10 17:26:19 +0000
committerThomas Bushnell <thomas@gnu.org>1997-04-10 17:26:19 +0000
commit9f61e0864a90b646e2ab89a05f1f8f13dddf7faa (patch)
treea8295dba818f8958a9b9f5d6baa57e4752ed0b7f /nfs
parent0cdbf8e72b6bd6abd3de96c1617f599b1fdbfba9 (diff)
Thu Apr 10 13:25:12 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* ops.c (netfs_attempt_set_size): Short circuit EACCES to cover one important case.
Diffstat (limited to 'nfs')
-rw-r--r--nfs/ChangeLog5
-rw-r--r--nfs/ops.c17
2 files changed, 22 insertions, 0 deletions
diff --git a/nfs/ChangeLog b/nfs/ChangeLog
index 9b2b81ea..3623a990 100644
--- a/nfs/ChangeLog
+++ b/nfs/ChangeLog
@@ -1,3 +1,8 @@
+Thu Apr 10 13:25:12 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
+
+ * ops.c (netfs_attempt_set_size): Short circuit EACCES to cover
+ one important case.
+
Fri Feb 21 16:47:35 1997 Miles Bader <miles@gnu.ai.mit.edu>
* main.c (netfs_append_args): Present the remote filesystem as a
diff --git a/nfs/ops.c b/nfs/ops.c
index 03d3be9b..52953ec7 100644
--- a/nfs/ops.c
+++ b/nfs/ops.c
@@ -323,6 +323,23 @@ netfs_attempt_set_size (struct iouser *cred, struct node *np,
p = process_wcc_stat (np, p, !err);
}
+ /* If we got EACCES, but the user has the file open for writing,
+ then the NFS protocol has screwed us. There's nothing we can do,
+ except in the important case of opens with
+ O_TRUNC|O_CREAT|O_WRONLY|O_EXCL where the new mode does not allow
+ writing. RCS, for example, uses this to create lock files. So permit
+ cases where the O_TRUNC isn't doing anything to succeed if the user
+ does have the file open for writing. */
+ if (err == EACCES && (cred->po->openstat & O_WRITE))
+ {
+ err = netfs_validate_stat (np, cred);
+ if (!err && np->nn_stat.st_size == size)
+ err = 0;
+ else
+ /* Never mind, put the old error back */
+ err = EACCES;
+ }
+
free (rpcbuf);
return err;
}