]> git.sur5r.net Git - openocd/commitdiff
server: Add port number to socket bind error
authorRobert Foss <robert.foss@collabora.com>
Wed, 7 Jun 2017 20:49:29 +0000 (16:49 -0400)
committerSpencer Oliver <spen@spen-soft.co.uk>
Tue, 3 Oct 2017 10:23:15 +0000 (11:23 +0100)
Make this error message more useful by providing the port number
that we tried to bind to.

Change-Id: Ieb18adf0725a6ae99c77ebfaadc49d64ed407bbe
Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-on: http://openocd.zylin.com/4157
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/server/server.c

index 8009d408feacac451e0a1b960c1ae0516ef8f7f2..517d62a79452d5c7ca5ae7cc7dccdf22f8fa9891 100644 (file)
@@ -273,7 +273,7 @@ int add_service(char *name,
                c->sin.sin_port = htons(c->portnumber);
 
                if (bind(c->fd, (struct sockaddr *)&c->sin, sizeof(c->sin)) == -1) {
-                       LOG_ERROR("couldn't bind %s to socket: %s", name, strerror(errno));
+                       LOG_ERROR("couldn't bind %s to socket on port %d: %s", name, c->portnumber, strerror(errno));
                        close_socket(c->fd);
                        free_service(c);
                        return ERROR_FAIL;