From 0d10a8a19f4aadde2d65892a08831a56cd5e53bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Boisnard?= Date: Thu, 13 Feb 2014 17:46:41 +0100 Subject: Fix hostDomainGenerator.sh error about localhost socket creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BZ: 171573 If localhost is not bound to 127.0.0.1, socket creation fails in the portAllocator.py script. This error is not well catched in the main tool hostDomainGenerator.sh. This patch updates portAllocator.py so that the IP address 127.0.0.1 is used instead of localhost. In addition, the potential error messages raised by portAllocator.py are now correctly taken into account by hostDomainGenerator.sh. HostDomainGenerator.sh has also been updated to replace all instances of 'localhost' by '127.0.0.1'. Change-Id: I7ed6ede7a1148360efac4bf38f49054066a50a29 Signed-off-by: Frédéric Boisnard --- tools/xmlGenerator/hostDomainGenerator.sh | 4 ++-- tools/xmlGenerator/portAllocator.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/xmlGenerator/hostDomainGenerator.sh b/tools/xmlGenerator/hostDomainGenerator.sh index 5b27513..a6e5f37 100755 --- a/tools/xmlGenerator/hostDomainGenerator.sh +++ b/tools/xmlGenerator/hostDomainGenerator.sh @@ -64,8 +64,8 @@ hostConfig="hostConfig.py" PFWScriptGenerator="PFWScriptGenerator.py" portAllocator="portAllocator.py" -TPHost=localhost -PFWHost=localhost +TPHost=127.0.0.1 +PFWHost=127.0.0.1 TPCreated=false HostRoot="$ANDROID_HOST_OUT" diff --git a/tools/xmlGenerator/portAllocator.py b/tools/xmlGenerator/portAllocator.py index 79a1c6b..64e1175 100755 --- a/tools/xmlGenerator/portAllocator.py +++ b/tools/xmlGenerator/portAllocator.py @@ -32,8 +32,8 @@ import sys, socket serversock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: - # Create a listening socket on a random available port - serversock.bind(('localhost',0)) + # Create a listening socket on a random available port on localhost + serversock.bind(('127.0.0.1',0)) serversock.listen(0) # Print the chosen port @@ -41,7 +41,7 @@ try: serversock.close() except socket.error, (errno,message): - print("Socket creation error " + str(errno) + ": " + message) + sys.stderr.write("portAllocator: Socket creation error " + str(errno) + ": " + message + '\n') if serversock: serversock.close() sys.exit(1) -- cgit v1.1