shithub: riscv

Download patch

ref: e1907b41d32441e79e8cc3db26afc5f0c4cdcef9
parent: f8f677b48ebaf490c6d870e8728285bc409789c0
author: mischief <[email protected]>
date: Mon Aug 20 08:48:06 EDT 2018

hjfs: set group of new files to that of the parent directory (thanks umbraticus)

--- a/sys/src/cmd/hjfs/fs2.c
+++ b/sys/src/cmd/hjfs/fs2.c
@@ -108,6 +108,7 @@
 	int isdir;
 	Loc *l;
 	FLoc f;
+	short pgid;
 
 	b = nil;
 	l = nil;
@@ -150,6 +151,7 @@
 	l = getloc(ch->fs, f, ch->loc);
 	modified(ch, d);
 	b->op |= BDELWRI;
+	pgid = d->gid;
 	putbuf(b);
 	b = nil;
 	if(willmodify(ch->fs, l, ch->flags & CHFNOLOCK) < 0)
@@ -164,7 +166,8 @@
 	strcpy(d->name, name);
 	d->mtime = time(0);
 	d->atime = d->mtime;
-	d->gid = d->uid = d->muid = ch->uid;
+	d->gid = pgid;
+	d->uid = d->muid = ch->uid;
 	d->mode = DALLOC | perm & 0777;
 	if((d->type & QTEXCL) != 0){
 		qlock(&ch->loc->ex);