RFR: 8314481: JDWPTRANSPORT_ERROR_INTERNAL code in socketTransport.c can never be executed

Daniel D. Daugherty dcubed at openjdk.org
Thu Aug 17 16:16:30 UTC 2023


On Thu, 17 Aug 2023 15:06:44 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

> [JDK-8250630](https://bugs.openjdk.org/browse/JDK-8250630) introduced the following change:
> 
> 
>      if (listenAddr == NULL) {
> +        // No address of preferred addres family found, grab the fist one.
> +        listenAddr = &(addrInfo[0]);
> +    }
> +
> +    if (listenAddr == NULL) {
>          dbgsysFreeAddrInfo(addrInfo);
>          RETURN_ERROR(JDWPTRANSPORT_ERROR_INTERNAL, "listen failed: wrong address");
>      }
> 
> 
> After this change it is no longer possible for the RETURN_ERROR block to ever be executed because listenAddr can not ever still be NULL. The entire block should be removed.

The change itself is fine.

src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c line 743:

> 741:     }
> 742: 
> 743:     if (listenAddr == NULL) {

There's a typo in the comment of the original change:

`// No address of preferred address family found, grab the fist one.`

nit typo: s/fist/first/

-------------

Marked as reviewed by dcubed (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15330#pullrequestreview-1582979841
PR Review Comment: https://git.openjdk.org/jdk/pull/15330#discussion_r1297447074


More information about the serviceability-dev mailing list