diff options
author | Thomas Bushnell <thomas@gnu.org> | 1997-04-10 17:26:19 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1997-04-10 17:26:19 +0000 |
commit | 9f61e0864a90b646e2ab89a05f1f8f13dddf7faa (patch) | |
tree | a8295dba818f8958a9b9f5d6baa57e4752ed0b7f /nfs/ops.c | |
parent | 0cdbf8e72b6bd6abd3de96c1617f599b1fdbfba9 (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/ops.c')
-rw-r--r-- | nfs/ops.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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; } |