File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -3113,7 +3113,13 @@ static int gdb_target_add_one(struct target *target)
31133113 if (!* end ) {
31143114 if (parse_long (gdb_port_next , & portnumber ) == ERROR_OK ) {
31153115 free (gdb_port_next );
3116- gdb_port_next = alloc_printf ("%d" , portnumber + 1 );
3116+ if (portnumber ) {
3117+ gdb_port_next = alloc_printf ("%d" , portnumber + 1 );
3118+ } else {
3119+ /* Don't increment if gdb_port is 0, since we're just
3120+ * trying to allocate an unused port. */
3121+ gdb_port_next = alloc_printf ("0" );
3122+ }
31173123 }
31183124 }
31193125 }
Original file line number Diff line number Diff line change @@ -273,7 +273,8 @@ int add_service(char *name,
273273 c -> sin .sin_port = htons (c -> portnumber );
274274
275275 if (bind (c -> fd , (struct sockaddr * )& c -> sin , sizeof (c -> sin )) == -1 ) {
276- LOG_ERROR ("couldn't bind %s to socket: %s" , name , strerror (errno ));
276+ LOG_ERROR ("couldn't bind %s to socket on port %d: %s" , name ,
277+ c -> portnumber , strerror (errno ));
277278 close_socket (c -> fd );
278279 free_service (c );
279280 return ERROR_FAIL ;
You can’t perform that action at this time.
0 commit comments