harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Hindess (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-6459) [classlib] [portlib] unix/hysock.c hysock_sockaddr_init6 has redundant code
Date Mon, 01 Mar 2010 10:02:05 GMT
[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.0M2, 5.0M14

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.

View raw message