diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-10-05 15:44:04 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-10-05 15:44:04 +0300 |
commit | 3edaa0f6738e29773cc4fa92dd96900c3e4f351e (patch) | |
tree | f50ef481af000ceda74af5b35cb2dc29e40be387 /pop3d/pop3d.c | |
parent | 3e13a4112af5136b08c4888f627151baee6a1aee (diff) | |
download | mailutils-3edaa0f6738e29773cc4fa92dd96900c3e4f351e.tar.gz mailutils-3edaa0f6738e29773cc4fa92dd96900c3e4f351e.tar.bz2 |
Remove the use of MAXHOSTNAMELEN macro.
* comsat/comsat.c (hostname): Change type.
(comsat_init): Use mu_get_host_name.
* comsat/comsat.h (hostname): Change declaration.
* mailbox/locker.c (lock_dotlock): Use mu_get_host_name.
* mailbox/mutil.c (mu_get_host_name): Rewrite.
* pop3d/pop3d.c (pop3d_mainloop): Remove unnecessary call to
gethostbyname.
* pop3d/pop3d.h (MAXHOSTNAMELEN): Remove definition.
Diffstat (limited to 'pop3d/pop3d.c')
-rw-r--r-- | pop3d/pop3d.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/pop3d/pop3d.c b/pop3d/pop3d.c index d0e7b6057..75a5fe757 100644 --- a/pop3d/pop3d.c +++ b/pop3d/pop3d.c @@ -226,19 +226,13 @@ pop3d_mainloop (int fd, FILE *infile, FILE *outfile) /* Prepare the shared secret for APOP. */ { char *local_hostname; - local_hostname = mu_alloc (MAXHOSTNAMELEN + 1); - - /* Get our canonical hostname. */ - { - struct hostent *htbuf; - gethostname (local_hostname, MAXHOSTNAMELEN); - htbuf = gethostbyname (local_hostname); - if (htbuf) - { - free (local_hostname); - local_hostname = strdup (htbuf->h_name); - } - } + + status = mu_get_host_name (&local_hostname); + if (status) + { + mu_diag_funcall (MU_DIAG_ERROR, "mu_get_host_name", NULL, status); + exit (EXIT_FAILURE); + } md5shared = mu_alloc (strlen (local_hostname) + 51); |