From a14f9efa6848f167f54dea3e3823b31dae1461c9 Mon Sep 17 00:00:00 2001 From: Jacob Moody Date: Sun, 18 Dec 2022 20:37:30 +0000 Subject: 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. --- sys/src/cmd/aux/listen.c | 11 +++++++---- 1 file 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); } -- cgit v1.2.3