/[mailutils]/mailutils/imap4d/util.c
ViewVC logotype

Diff of /mailutils/imap4d/util.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.31 by gray, Thu Feb 7 07:55:24 2002 UTC revision 1.32 by gray, Thu Feb 7 16:02:05 2002 UTC
# Line 858  util_localname () Line 858  util_localname ()
858        char *name;        char *name;
859        int name_len = 256;        int name_len = 256;
860        int status;        int status;
861                  struct hostent *hp;
862          
863        name = malloc (name_len);        name = malloc (name_len);
864        while (name        while (name
865               && (status = gethostname (name, name_len)) == 0               && (status = gethostname (name, name_len)) == 0
# Line 872  util_localname () Line 873  util_localname ()
873            syslog (LOG_CRIT, "Can't find out my own hostname");            syslog (LOG_CRIT, "Can't find out my own hostname");
874            exit (1);            exit (1);
875          }          }
876                    
877          hp = gethostbyname (name);
878          if (hp)
879            {
880              struct in_addr inaddr;
881              inaddr.s_addr = *(unsigned int*)hp->h_addr;
882              hp = gethostbyaddr ((const char *)&inaddr,
883                                  sizeof (struct in_addr), AF_INET);
884              if (hp)
885                {
886                  free (name);
887                  name = strdup ((char *)hp->h_name);
888                }
889            }
890        localname = name;        localname = name;
891      }      }
892    return localname;    return localname;

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26