vacfs: fix create srv with ORCLOSE 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. This change has been reviewed and merged in plan9port. Reference: /n/sources/patch/applied/vacfs-srv-orclose Date: Fri Aug 3 21:21:48 CES 2012 Signed-off-by: djc@9grid.fr --- /sys/src/cmd/vac/vacfs.c Fri Aug 3 21:21:36 2012 +++ /sys/src/cmd/vac/vacfs.c Fri Aug 3 21:21:32 2012 @@ -200,12 +200,6 @@ mfd[0] = p[0]; mfd[1] = p[0]; srvfd = p[1]; - } - - procrfork(srv, 0, Stacksize, RFFDG|RFNAMEG|RFNOTEG); - - if(!stdio){ - close(p[0]); if(defsrv){ srvname = smprint("/srv/%s", defsrv); fd = create(srvname, OWRITE|ORCLOSE, 0666); @@ -215,6 +209,12 @@ sysfatal("write %s: %r", srvname); free(srvname); } + } + + procrfork(srv, 0, Stacksize, RFFDG|RFNAMEG|RFNOTEG); + + if(!stdio){ + close(p[0]); if(defmnt){ if(mount(srvfd, -1, defmnt, MREPL|MCREATE, "") < 0) sysfatal("mount %s: %r", defmnt);