summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-07-12 18:52:28 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2020-07-12 18:52:28 +0200
commita469cffafe23135da443b078bf82ad45833ff37a (patch)
tree9a996f7d2864a70e4a3aa8fc482f69b7b07e0795
parent1987cc69c8c2f071762da025a84903dcc8197855 (diff)
downloadplan9front-a469cffafe23135da443b078bf82ad45833ff37a.tar.xz
cwfs: update mtime and qid.vers for directory on rename
when wstating a file, its directory should be updated to reflect this change. here is what the manpage states: > The mtime field reflects the time of the last change of content > (except when later changed by wstat). For a directory it is the > time of the most recent remove, create, or wstat of a file in the > directory.
-rw-r--r--sys/src/cmd/cwfs/9p2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/src/cmd/cwfs/9p2.c b/sys/src/cmd/cwfs/9p2.c
index 1bf9b7fce..a4d129c97 100644
--- a/sys/src/cmd/cwfs/9p2.c
+++ b/sys/src/cmd/cwfs/9p2.c
@@ -1656,6 +1656,7 @@ fs_wstat(Chan* chan, Fcall* f, Fcall*, char* strs)
* If the name is really to be changed check it's unique
* and there is write permission in the parent.
*/
+ d1 = nil;
if(dir.name != d->name){
/*
* First get parent.
@@ -1786,6 +1787,9 @@ fs_wstat(Chan* chan, Fcall* f, Fcall*, char* strs)
d->gid = gid;
d->muid = muid;
p->flags |= Bmod;
+
+ if(p1 != nil)
+ accessdir(p1, d1, FWRITE, file->uid);
}
if(!tsync)
accessdir(p, d, FREAD, file->uid);