code: 9ferno

Download patch

ref: 0ce528656814a53421d0f820e491786955076018
parent: 40bf48455a9e8447c3124c672917734bf58a5c00
author: 9ferno <gophone2015@gmail.com>
date: Sat Jul 24 00:11:41 EDT 2021

fixed bug in mkfs processing of directories

disk/mkfs after creating a directory or file updates the mtime.

But, disk/kfs does not allow a stat change to a directory if the mode is not
the default of ~0. Why? I don't know.

disk/kfs log
<- Tmsg.Wstat(1,163,Dir("","","joe",Qid(16rffffffffffffffff,-1,16rff),8r20000000755,-1,1627005381,-1,16rffff,-1))
-> Rmsg.Error(1,"wstat -- attempt to change directory")

--- a/appl/cmd/disk/mkfs.b
+++ b/appl/cmd/disk/mkfs.b
@@ -426,7 +426,12 @@
 	}
 	fd := sys->create(newfile, Sys->OREAD, d.mode);
 	nd := sys->nulldir;
-	nd.mode = d.mode;
+	# if dir, then send the default value of mode to avoid the Enotd error
+	#	raised by kfs
+	#<- Tmsg.Wstat(1,163,Dir("","","joe",Qid(16rffffffffffffffff,-1,16rff),8r20000000755,-1,1627005381,-1,16rffff,-1))
+	#-> Rmsg.Error(1,"wstat -- attempt to change directory")
+	if(d.mode & Sys->DMDIR == 0) # file
+		nd.mode = d.mode;
 	nd.gid = d.gid;
 	nd.mtime = d.mtime;
 	if(fd == nil){