aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vac
diff options
context:
space:
mode:
authorDavid du Colombier <0intro@gmail.com>2012-08-03 21:12:10 +0200
committerDavid du Colombier <0intro@gmail.com>2012-08-03 21:12:10 +0200
commit3a616eaa80070a1b89b907baacc8b603b02c670e (patch)
treefcb7fc08a326597627c0e06185464ef7bb133e40 /src/cmd/vac
parentac2662695a41207618873798914d70242b826a63 (diff)
downloadplan9port-3a616eaa80070a1b89b907baacc8b603b02c670e.tar.gz
plan9port-3a616eaa80070a1b89b907baacc8b603b02c670e.tar.bz2
plan9port-3a616eaa80070a1b89b907baacc8b603b02c670e.zip
vacfs: fix create srv with ORCLOSE on plan 9
In the current code, the srv file is removed just after the main thread exits, while the srv thread is still running, which is not the expected behavior. We moved the srv creation just before the procrfork, in order that the srv file will not be removed until the srv thread exits. R=rsc http://codereview.appspot.com/6397047
Diffstat (limited to 'src/cmd/vac')
-rw-r--r--src/cmd/vac/vacfs.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/cmd/vac/vacfs.c b/src/cmd/vac/vacfs.c
index c6609397..643b6c46 100644
--- a/src/cmd/vac/vacfs.c
+++ b/src/cmd/vac/vacfs.c
@@ -233,6 +233,17 @@ threadmain(int argc, char *argv[])
mfd[0] = p[0];
mfd[1] = p[0];
srvfd = p[1];
+#ifndef PLAN9PORT
+ if(defsrv){
+ srvname = smprint("/srv/%s", defsrv);
+ fd = create(srvname, OWRITE|ORCLOSE, 0666);
+ if(fd < 0)
+ sysfatal("create %s: %r", srvname);
+ if(fprint(fd, "%d", srvfd) < 0)
+ sysfatal("write %s: %r", srvname);
+ free(srvname);
+ }
+#endif
}
#ifdef PLAN9PORT
@@ -245,15 +256,6 @@ threadmain(int argc, char *argv[])
if(!stdio){
close(p[0]);
- if(defsrv){
- srvname = smprint("/srv/%s", defsrv);
- fd = create(srvname, OWRITE|ORCLOSE, 0666);
- if(fd < 0)
- sysfatal("create %s: %r", srvname);
- if(fprint(fd, "%d", srvfd) < 0)
- sysfatal("write %s: %r", srvname);
- free(srvname);
- }
if(defmnt){
if(mount(srvfd, -1, defmnt, MREPL|MCREATE, "") < 0)
sysfatal("mount %s: %r", defmnt);