Changeset fa8f439


Ignore:
Timestamp:
May 5, 2009, 1:43:48 PM (15 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
e1b136bf
Parents:
c0b1a40
Message:
Woah!  I know strict aliasing!

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfaim/ft.c

    rdd0edbf rfa8f439  
    253253{
    254254        int acceptfd = 0;
    255         struct sockaddr addr;
     255        union { struct sockaddr sa; struct sockaddr_in sin; } addr;
    256256        socklen_t addrlen = sizeof(addr);
    257257        int ret = 0;
     
    260260        int port;
    261261
    262         if ((acceptfd = accept(cur->fd, &addr, &addrlen)) == -1)
     262        if ((acceptfd = accept(cur->fd, &addr.sa, &addrlen)) == -1)
    263263                return 0; /* not an error */
    264264
    265         if ((addr.sa_family != AF_INET) && (addr.sa_family != AF_INET6)) { /* just in case IPv6 really is happening */
     265        if (addr.sa.sa_family != AF_INET) { /* This code needs way more help to get IPv6 right. */
    266266                close(acceptfd);
    267267                aim_conn_close(cur);
     
    269269        }
    270270
    271         strncpy(ip, inet_ntoa(((struct sockaddr_in *)&addr)->sin_addr), sizeof(ip));
    272         port = ntohs(((struct sockaddr_in *)&addr)->sin_port);
     271        strncpy(ip, inet_ntoa(addr.sin.sin_addr), sizeof(ip));
     272        port = ntohs(addr.sin.sin_port);
    273273
    274274        if (!(newconn = aim_cloneconn(sess, cur))) {
Note: See TracChangeset for help on using the changeset viewer.