You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mark Hindess (JIRA)" <ji...@apache.org> on 2010/05/14 22:00:43 UTC

[jira] Updated: (HARMONY-6459) [classlib] [portlib] unix/hysock.c hysock_sockaddr_init6 has redundant code

     [ https://issues.apache.org/jira/browse/HARMONY-6459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Hindess updated HARMONY-6459:
----------------------------------

    Fix Version/s: 6.0M3
                   5.0M15
                       (was: 5.0M14)
                       (was: 6.0M2)

This isn't urgent so I'm deferring fixing it until 5.0M15 and 6.0M3.


> [classlib] [portlib] unix/hysock.c hysock_sockaddr_init6 has redundant code
> ---------------------------------------------------------------------------
>
>                 Key: HARMONY-6459
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6459
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 6.0M1, 5.0M13
>            Reporter: Mark Hindess
>            Assignee: Mark Hindess
>             Fix For: 6.0M3, 5.0M15
>
>
> hysock_sockaddr_init6 has code like:
>   memset (handle, 0, sizeof (struct hysockaddr_struct));
>   if (...) {
>     ...
>   } else { # IPv6
>     sockaddr_6 = (OSSOCKADDR_IN6 *) & handle->addr;
>     ...
>     sockaddr_6->sin6_len = sizeof (struct sockaddr_in6);
>     if (((OSSOCKADDR_IN6 *) & handle->addr)->sin6_len != 0) {
>       sockaddr_6->sin6_len = ((OSSOCKADDR_IN6 *) & handle->addr)->sin6_len;
>     }
> The content of the last if looks bogus because "sockaddr_6" is equivalent to "((OSSOCKADDR_IN6 *) & handle->addr)" (by virtue of the first line of the else) so the left-hand side and right-hand side are the same field.  Also, because of the same equivalence of the two structures, the sin6_len if is always executed since sin6_len field is assigned a non-zero value on the preceding line.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.