##// END OF EJS Templates
posix: avoid a leaked file descriptor in a unix domain socket exception case...
Matt Harbison -
r46310:87c35b5a default
parent child Browse files
Show More
@@ -764,10 +764,14 b' def bindunixsocket(sock, path):'
764 764 # platforms (see sys/un.h)
765 765 dirname, basename = os.path.split(path)
766 766 bakwdfd = None
767 if dirname:
768 bakwdfd = os.open(b'.', os.O_DIRECTORY)
769 os.chdir(dirname)
770 sock.bind(basename)
771 if bakwdfd:
772 os.fchdir(bakwdfd)
773 os.close(bakwdfd)
767
768 try:
769 if dirname:
770 bakwdfd = os.open(b'.', os.O_DIRECTORY)
771 os.chdir(dirname)
772 sock.bind(basename)
773 if bakwdfd:
774 os.fchdir(bakwdfd)
775 finally:
776 if bakwdfd:
777 os.close(bakwdfd)
General Comments 0
You need to be logged in to leave comments. Login now