Changeset 7435ccf for irc.c


Ignore:
Timestamp:
2007-10-18T19:03:02Z (17 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
2231302
Parents:
e9b755e
Message:

Fix indentation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc.c

    re9b755e r7435ccf  
    4646        irc_t *irc;
    4747        struct sockaddr_storage sock;
    48         socklen_t socklen = sizeof(sock);
     48        socklen_t socklen = sizeof( sock );
    4949       
    5050        irc = g_new0( irc_t, 1 );
     
    6767        if( global.conf->hostname )
    6868                irc->myhost = g_strdup( global.conf->hostname );
    69         else if( getsockname( irc->fd, (struct sockaddr*) &sock, &socklen ) == 0)
    70         {
    71                 irc->myhost = g_new0(char, NI_MAXHOST);
    72 
    73                 if (getnameinfo((struct sockaddr *)&sock, socklen, irc->myhost,
    74                                                 NI_MAXHOST, NULL, -1, 0)) {
     69        else if( getsockname( irc->fd, (struct sockaddr*) &sock, &socklen ) == 0 )
     70        {
     71                irc->myhost = g_new0( char, NI_MAXHOST );
     72
     73                if (getnameinfo( (struct sockaddr *) &sock, socklen, irc->myhost,
     74                                                NI_MAXHOST, NULL, -1, 0) ) {
    7575                        /* Rare, but possible. */
    76                         strncpy(irc->myhost, "localhost.", NI_MAXHOST);
    77                 }
    78         }
    79        
    80         if( getpeername( irc->fd, (struct sockaddr*) &sock, &socklen ) == 0)
    81         {
    82                 irc->host = g_new0(char, NI_MAXHOST);
    83 
    84                 if (getnameinfo((struct sockaddr *)&sock, socklen, irc->host,
    85                                                 NI_MAXHOST, NULL, -1, 0)) {
     76                        strncpy( irc->myhost, "localhost.", NI_MAXHOST );
     77                }
     78        }
     79       
     80        if( getpeername( irc->fd, (struct sockaddr*) &sock, &socklen ) == 0 )
     81        {
     82                irc->host = g_new0( char, NI_MAXHOST );
     83
     84                if ( getnameinfo( (struct sockaddr *)&sock, socklen, irc->host,
     85                                                NI_MAXHOST, NULL, -1, 0 ) ) {
    8686                        /* Rare, but possible. */
    87                         strncpy(irc->myhost, "localhost.", NI_MAXHOST);
     87                        strncpy( irc->myhost, "localhost.", NI_MAXHOST );
    8888                }
    8989        }
Note: See TracChangeset for help on using the changeset viewer.