summaryrefslogtreecommitdiff
path: root/sys/src/lib9p/srv.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-03-08 22:00:23 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2020-03-08 22:00:23 +0100
commite9e55a21f66a3eff114025dcb1fe62570d0fa3e6 (patch)
tree779a635590ee01c03219b4054757ec7fc905904d /sys/src/lib9p/srv.c
parent11628e90fb85137a3f02e4ad5c343c15a90846b5 (diff)
lib9p: implement automatic remove-on-close cleanup in postsharesrv(), remove postfd() and sharefd() functions
with the latest changes to shr(3), we can use ORCLOSE on the control file to get the mount in the share automatically removed when the server exits or something goes wrong during postsharesrv(). do not expose postfd() and sharefd() functions. they where undocumented and leak the control file descriptors.
Diffstat (limited to 'sys/src/lib9p/srv.c')
-rw-r--r--sys/src/lib9p/srv.c56
1 files changed, 0 insertions, 56 deletions
diff --git a/sys/src/lib9p/srv.c b/sys/src/lib9p/srv.c
index 25276d2ad..a764f9c78 100644
--- a/sys/src/lib9p/srv.c
+++ b/sys/src/lib9p/srv.c
@@ -918,59 +918,3 @@ responderror(Req *r)
rerrstr(errbuf, sizeof errbuf);
respond(r, errbuf);
}
-
-int
-postfd(char *name, int pfd)
-{
- int fd;
- char buf[80];
-
- snprint(buf, sizeof buf, "/srv/%s", name);
- if(chatty9p)
- fprint(2, "postfd %s\n", buf);
- fd = create(buf, OWRITE|ORCLOSE|OCEXEC, 0600);
- if(fd < 0){
- if(chatty9p)
- fprint(2, "create fails: %r\n");
- return -1;
- }
- if(fprint(fd, "%d", pfd) < 0){
- if(chatty9p)
- fprint(2, "write fails: %r\n");
- close(fd);
- return -1;
- }
- if(chatty9p)
- fprint(2, "postfd successful\n");
- return 0;
-}
-
-int
-sharefd(char *name, char *desc, int pfd)
-{
- int fd;
- char buf[80];
-
- snprint(buf, sizeof buf, "#σc/%s", name);
- if((fd = create(buf, OREAD, 0700|DMDIR)) >= 0)
- close(fd);
- snprint(buf, sizeof buf, "#σc/%s/%s", name, desc);
- if(chatty9p)
- fprint(2, "sharefd %s\n", buf);
- fd = create(buf, OWRITE, 0600);
- if(fd < 0){
- if(chatty9p)
- fprint(2, "create fails: %r\n");
- return -1;
- }
- if(fprint(fd, "%d\n", pfd) < 0){
- if(chatty9p)
- fprint(2, "write fails: %r\n");
- close(fd);
- return -1;
- }
- close(fd);
- if(chatty9p)
- fprint(2, "sharefd successful\n");
- return 0;
-}