summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipaserver/installutils.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipa-server/ipaserver/installutils.py')
-rw-r--r--ipa-server/ipaserver/installutils.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/ipa-server/ipaserver/installutils.py b/ipa-server/ipaserver/installutils.py
index 3d09e85c..c261e530 100644
--- a/ipa-server/ipaserver/installutils.py
+++ b/ipa-server/ipaserver/installutils.py
@@ -27,6 +27,7 @@ import fileinput
import sys
import time
import struct
+import fcntl
from ipa import ipautil
from ipa import dnsclient
@@ -104,9 +105,8 @@ def port_available(port):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ fcntl.fcntl(s, fcntl.F_SETFD, fcntl.FD_CLOEXEC)
s.bind(('', port))
- s.shutdown(0)
s.close()
except socket.error, e:
if e[0] == errno.EADDRINUSE:
@@ -115,9 +115,8 @@ def port_available(port):
if rv:
try:
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
- s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ fcntl.fcntl(s, fcntl.F_SETFD, fcntl.FD_CLOEXEC)
s.bind(('', port))
- s.shutdown(0)
s.close()
except socket.error, e:
if e[0] == errno.EADDRINUSE: