ref: c723aaccf5a4a24c622d4308dc0d4d90c751c2d0
parent: 97646782c8d9b5f5552e21333b55bd6b3902ee6c
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jun 3 19:30:05 EDT 2018
devenv: make #ec files not show up as world writable
--- a/sys/man/3/env
+++ b/sys/man/3/env
@@ -49,7 +49,6 @@
All processes see the same
.BR #ec ;
its contents are writable only by the host owner.
-[XXX actually everything is world writable; that's a mistake.]
.SH SEE ALSO
.IR rc (1),
.IR fork (2),
--- a/sys/src/9/port/devenv.c
+++ b/sys/src/9/port/devenv.c
@@ -37,7 +37,7 @@
Evalue *e;
if(s == DEVDOTDOT){- devdir(c, c->qid, "#e", 0, eve, DMDIR|0775, dp);
+ devdir(c, c->qid, "#e", 0, eve, 0775, dp);
return 1;
}
@@ -56,7 +56,8 @@
/* make sure name string continues to exist after we release lock */
kstrcpy(up->genbuf, e->name, sizeof up->genbuf);
- devdir(c, e->qid, up->genbuf, e->len, eve, 0666, dp);
+ devdir(c, e->qid, up->genbuf, e->len, eve,
+ eg == &confegrp || eg != up->egrp ? 0664: 0666, dp);
runlock(eg);
return 1;
}
@@ -394,7 +395,7 @@
char buf[2*KNAMELEN];
snprint(buf, sizeof(buf), "#e%s/%s", conf?"c":"", ename);
- c = namec(buf, Acreate, OWRITE, 0600);
+ c = namec(buf, Acreate, OWRITE, 0666);
devtab[c->type]->write(c, eval, strlen(eval), 0);
cclose(c);
}
--
⑨