changeset 29529:02de1dbd4f6e

chgserver: narrow scope of chdir() to socket.bind() This helps extracting a utility function.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 21 May 2016 16:42:59 +0900
parents 9c3786713926
children 3239e2fdd2e2
files hgext/chgserver.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/chgserver.py	Mon Jul 11 15:45:34 2016 +0200
+++ b/hgext/chgserver.py	Sat May 21 16:42:59 2016 +0900
@@ -587,13 +587,13 @@
             bakwdfd = os.open('.', os.O_DIRECTORY)
             os.chdir(dirname)
         self.socket.bind(basename)
-        self._socketstat = os.stat(basename)
-        # rename will replace the old socket file if exists atomically. the
-        # old server will detect ownership change and exit.
-        util.rename(basename, self.server_address)
         if bakwdfd:
             os.fchdir(bakwdfd)
             os.close(bakwdfd)
+        self._socketstat = os.stat(tempaddress)
+        # rename will replace the old socket file if exists atomically. the
+        # old server will detect ownership change and exit.
+        util.rename(tempaddress, self.server_address)
 
     def issocketowner(self):
         try: