shithub: riscv

Download patch

ref: a469cffafe23135da443b078bf82ad45833ff37a
parent: 1987cc69c8c2f071762da025a84903dcc8197855
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jul 12 14:52:28 EDT 2020

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.

--- a/sys/src/cmd/cwfs/9p2.c
+++ b/sys/src/cmd/cwfs/9p2.c
@@ -1656,6 +1656,7 @@
 	 * 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 @@
 		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);