changed error policy when obtaining ip and hostname - fiche - A pastebin adjusted for gopher use
 (HTM) git clone git://vernunftzentrum.de/fiche.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 7b48aed40239012e2ee068826a3225b93a0ddcc5
 (DIR) parent c1e37117428266b13b33ea2ce5cb7fb9a076c9b4
 (HTM) Author: solusipse <solus1ps3@gmail.com>
       Date:   Mon, 16 Sep 2013 13:37:44 +0200
       
       changed error policy when obtaining ip and hostname
       
       Diffstat:
         fiche.c                             |      15 ++++++++++++---
       
       1 file changed, 12 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/fiche.c b/fiche.c
       @@ -155,17 +155,26 @@ struct client_data get_client_address(struct sockaddr_in client_address)
        
            hostp = gethostbyaddr((const char *)&client_address.sin_addr.s_addr, sizeof(client_address.sin_addr.s_addr), AF_INET);
            if (hostp == NULL)
       +    {
                nerror("ERROR: Couldn't obtain client's address");
       +        data.hostname = "error";
       +    }
       +    else
       +        data.hostname = hostp->h_name;
        
            hostaddrp = inet_ntoa(client_address.sin_addr);
            if (hostaddrp == NULL)
       +    {
                nerror("ERROR: Couldn't obtain client's address");
       +        data.ip_address = "error";
       +    }
       +    else
       +        data.ip_address = hostaddrp;
        
            display_date();
       -    printf("Client: %s (%s)\n", hostaddrp, hostp->h_name);
       +    printf("Client: %s (%s)\n", data.ip_address, data.hostname);
        
       -    data.ip_address = hostaddrp;
       -    data.hostname = hostp->h_name;
       +    
        
            return data;
        }