harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Ellison (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-6459) [classlib] [portlib] unix/hysock.c hysock_sockaddr_init6 has redundant code
Date Fri, 03 Sep 2010 11:03:40 GMT

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

Tim Ellison updated HARMONY-6459:
---------------------------------

    Fix Version/s:     (was: 5.0M15)
                       (was: 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
>
> 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.


Mime
View raw message