##// END OF EJS Templates
chgserver: use relative path at socket.bind...
Jun Wu -
r28768:2461f33c default
parent child Browse files
Show More
@@ -611,11 +611,22 b' class AutoExitMixIn: # use old-style to'
611 # use a unique temp address so we can stat the file and do ownership
611 # use a unique temp address so we can stat the file and do ownership
612 # check later
612 # check later
613 tempaddress = _tempaddress(self.server_address)
613 tempaddress = _tempaddress(self.server_address)
614 self.socket.bind(tempaddress)
614 # use relative path instead of full path at bind() if possible, since
615 self._socketstat = os.stat(tempaddress)
615 # AF_UNIX path has very small length limit (107 chars) on common
616 # platforms (see sys/un.h)
617 dirname, basename = os.path.split(tempaddress)
618 bakwdfd = None
619 if dirname:
620 bakwdfd = os.open('.', os.O_DIRECTORY)
621 os.chdir(dirname)
622 self.socket.bind(basename)
623 self._socketstat = os.stat(basename)
616 # rename will replace the old socket file if exists atomically. the
624 # rename will replace the old socket file if exists atomically. the
617 # old server will detect ownership change and exit.
625 # old server will detect ownership change and exit.
618 util.rename(tempaddress, self.server_address)
626 util.rename(basename, self.server_address)
627 if bakwdfd:
628 os.fchdir(bakwdfd)
629 os.close(bakwdfd)
619
630
620 def issocketowner(self):
631 def issocketowner(self):
621 try:
632 try:
General Comments 0
You need to be logged in to leave comments. Login now