From e1907b41d32441e79e8cc3db26afc5f0c4cdcef9 Mon Sep 17 00:00:00 2001 From: mischief Date: Mon, 20 Aug 2018 12:48:06 -0700 Subject: [PATCH] hjfs: set group of new files to that of the parent directory (thanks umbraticus) --- sys/src/cmd/hjfs/fs2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/src/cmd/hjfs/fs2.c b/sys/src/cmd/hjfs/fs2.c index 8befb2426..064697244 100644 --- a/sys/src/cmd/hjfs/fs2.c +++ b/sys/src/cmd/hjfs/fs2.c @@ -108,6 +108,7 @@ chancreat(Chan *ch, char *name, int perm, int mode) int isdir; Loc *l; FLoc f; + short pgid; b = nil; l = nil; @@ -150,6 +151,7 @@ chancreat(Chan *ch, char *name, int perm, int mode) 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 @@ chancreat(Chan *ch, char *name, int perm, int mode) 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);