# HG changeset patch # User Yuya Nishihara # Date 2016-05-21 07:42:59 # Node ID 02de1dbd4f6e07cd31b0f763ddc9d953147a29ed # Parent 9c3786713926a7cf08fd3abb00faf6eb442d1b0d chgserver: narrow scope of chdir() to socket.bind() This helps extracting a utility function. diff --git a/hgext/chgserver.py b/hgext/chgserver.py --- a/hgext/chgserver.py +++ b/hgext/chgserver.py @@ -587,13 +587,13 @@ class AutoExitMixIn: # use old-style to 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: