ref: a2623fd82a1a49ee588b1ff14b0aa472d30a5ee2
parent: 182077ac24010f8065755ea903bf57c829b0220a
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);
}