summaryrefslogtreecommitdiff
path: root/sys/src/cmd
diff options
context:
space:
mode:
authorJacob Moody <moody@posixcafe.org>2022-12-18 20:37:30 +0000
committerJacob Moody <moody@posixcafe.org>2022-12-18 20:37:30 +0000
commita14f9efa6848f167f54dea3e3823b31dae1461c9 (patch)
tree108144d604ef11e59a8acccba0a7d52c52adb206 /sys/src/cmd
parent6661936e28c85c94190611858cf68290998061e8 (diff)
aux/listen: tweak per service namespaces
move in to the namespace earlier before the announce. Only attempt and complain to syslog when the file already exists, but if building the new namespace fails we should bail.
Diffstat (limited to 'sys/src/cmd')
-rw-r--r--sys/src/cmd/aux/listen.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/src/cmd/aux/listen.c b/sys/src/cmd/aux/listen.c
index ad91f85af..e9f0d68df 100644
--- a/sys/src/cmd/aux/listen.c
+++ b/sys/src/cmd/aux/listen.c
@@ -149,7 +149,7 @@ dingdong(void*, char *msg)
void
listendir(char *srvdir, int trusted)
{
- int ctl, pid, start, i;
+ int ctl, pid, start;
char dir[40], err[128], ds[128];
char prog[Maxpath], serv[Maxserv], ns[Maxpath];
long childs;
@@ -206,6 +206,12 @@ listendir(char *srvdir, int trusted)
syslog(1, listenlog, "couldn't fork for %s", ds);
break;
case 0:
+ /* optional per service namespace files */
+ if(!trusted && access(ns, AEXIST)==0)
+ if(newns("none", ns) < 0){
+ syslog(1, listenlog, "can't build namespace %s: %r\n", ns);
+ exits("newns");
+ }
childs = 0;
for(;;){
ctl = announce(ds, dir);
@@ -222,9 +228,6 @@ listendir(char *srvdir, int trusted)
exits("ctl");
}
procsetname("%s %s", dir, ds);
- if(!trusted)
- if(newns("none", ns) < 0)
- syslog(0, listenlog, "can't build namespace %s: %r\n", ns);
dolisten(dir, ctl, serv, prog, &childs);
close(ctl);
}