summaryrefslogtreecommitdiff
path: root/sys/src/cmd/plumb/fsys.c
diff options
context:
space:
mode:
authorqwx <qwx@sciops.net>2021-09-10 21:03:47 +0000
committerqwx <qwx@sciops.net>2021-09-10 21:03:47 +0000
commite2796993445b62379e908564e900e6955b30b830 (patch)
treeafebb908130b8490572e0a7a9c8783f2289da153 /sys/src/cmd/plumb/fsys.c
parentd1986d8c0e6369923f2761a7349ecb1ab7c70da8 (diff)
plumber: remove $plumbsrv, add optional srvname, usage check
Plumber both posts a service to /srv and sets a $plumbsrv environment variable. Our libplumb no longer uses $plumbsrv and nothing else does. It's a silly hack; rc doesn't update /env immediately, and scripts, which for instance set up subrios, cannot rely on it to clean up the plumber at the end. Instead, add the option to specify a srvname, actually check for some common errors and print a usage string. Thanks to Ori for input and a preliminary patch.
Diffstat (limited to 'sys/src/cmd/plumb/fsys.c')
-rw-r--r--sys/src/cmd/plumb/fsys.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/src/cmd/plumb/fsys.c b/sys/src/cmd/plumb/fsys.c
index 378543139..db3ff6b54 100644
--- a/sys/src/cmd/plumb/fsys.c
+++ b/sys/src/cmd/plumb/fsys.c
@@ -218,9 +218,10 @@ startfsys(void)
clock = getclock();
if(cexecpipe(&mntfd, &srvfd) < 0)
error("can't create pipe: %r");
- sprint(srvfile, "/srv/plumb.%s.%d", user, getpid());
- if(putenv("plumbsrv", srvfile) < 0)
- error("can't write $plumbsrv: %r");
+ if(srvname == nil)
+ snprint(srvfile, sizeof(srvfile), "/srv/plumb.%s.%d", user, getpid());
+ else
+ snprint(srvfile, sizeof(srvfile), "/srv/%s", srvname);
fd = create(srvfile, OWRITE|OCEXEC|ORCLOSE, 0600);
if(fd < 0)
error("can't create /srv file: %r");