ref: a14f9efa6848f167f54dea3e3823b31dae1461c9
parent: 6661936e28c85c94190611858cf68290998061e8
author: Jacob Moody <moody@posixcafe.org>
date: Sun Dec 18 15:37:30 EST 2022
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.
--- a/sys/src/cmd/aux/listen.c
+++ b/sys/src/cmd/aux/listen.c
@@ -149,7 +149,7 @@
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 @@
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 @@
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);
}