summaryrefslogtreecommitdiff
path: root/sys/src/cmd/webfs
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-06-04 17:45:08 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2014-06-04 17:45:08 +0200
commit863a459691f1a75ee687174df76e78dffa58f4f2 (patch)
tree8e5870ff5a586d6f1b602938a27ce9d97570a825 /sys/src/cmd/webfs
parent972f60a794bb58d9c99014dc28ec88e7883cea5d (diff)
webfs: explicitely unmount old /mnt/web (thanks BurnZeZ)
webfs forks the namespace to isolate itself from its mount point which has the side effect that it captures the mount of previous instances of webfs mounted on /mnt/web. explicitely unmount the mountpoint in our namespace copy to drop the reference.
Diffstat (limited to 'sys/src/cmd/webfs')
-rw-r--r--sys/src/cmd/webfs/fs.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/sys/src/cmd/webfs/fs.c b/sys/src/cmd/webfs/fs.c
index 076f2acbb..65b4e4ce7 100644
--- a/sys/src/cmd/webfs/fs.c
+++ b/sys/src/cmd/webfs/fs.c
@@ -76,6 +76,8 @@ static char *nametab[] = {
nil,
};
+static char *mtpt;
+static char *service;
static long time0;
static char *user;
static char *agent;
@@ -741,8 +743,17 @@ fsdestroyfid(Fid *fid)
}
}
+static void
+fsstart(Srv*)
+{
+ /* drop reference to old webfs mount */
+ if(mtpt != nil)
+ unmount(nil, mtpt);
+}
+
Srv fs =
{
+ .start=fsstart,
.attach=fsattach,
.stat=fsstat,
.walk1=fswalk1,
@@ -757,26 +768,24 @@ Srv fs =
void
usage(void)
{
- fprint(2, "usage: %s [-D] [-A useragent] [-T timeout] [-m mtpt] [-s srv]\n", argv0);
+ fprint(2, "usage: %s [-D] [-A useragent] [-T timeout] [-m mtpt] [-s service]\n", argv0);
exits("usage");
}
void
main(int argc, char *argv[])
{
- char *srv, *mtpt, *s;
+ char *s;
quotefmtinstall();
fmtinstall('U', Ufmt);
fmtinstall('H', Hfmt);
fmtinstall('E', Efmt);
- srv = nil;
mtpt = "/mnt/web";
user = getuser();
time0 = time(0);
timeout = 10000;
- agent = nil;
ARGBEGIN {
case 'D':
@@ -794,7 +803,7 @@ main(int argc, char *argv[])
mtpt = EARGF(usage());
break;
case 's':
- srv = EARGF(usage());
+ service = EARGF(usage());
break;
case 'd':
debug++;
@@ -814,6 +823,6 @@ main(int argc, char *argv[])
free(s);
}
- postmountsrv(&fs, srv, mtpt, MREPL);
+ postmountsrv(&fs, service, mtpt, MREPL);
exits(0);
}