When gdb_port is 0, don't increment it.

Usually incrementing to get the next port is a good idea, but when set
to 0 the idea is to find an arbitrary unallocated port. 1 is almost
certainly not helpful.
This commit is contained in:
Tim Newsome
2017-08-07 13:55:37 -07:00
parent b9822ab1b8
commit b897807224
2 changed files with 9 additions and 2 deletions
+2 -1
View File
@@ -273,7 +273,8 @@ 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;