summaryrefslogtreecommitdiff
path: root/comsat/comsat.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-10-05 15:44:04 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2010-10-05 15:44:04 +0300
commit3edaa0f6738e29773cc4fa92dd96900c3e4f351e (patch)
treef50ef481af000ceda74af5b35cb2dc29e40be387 /comsat/comsat.c
parent3e13a4112af5136b08c4888f627151baee6a1aee (diff)
downloadmailutils-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 'comsat/comsat.c')
-rw-r--r--comsat/comsat.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/comsat/comsat.c b/comsat/comsat.c
index 82e8056e6..3fe9e365a 100644
--- a/comsat/comsat.c
+++ b/comsat/comsat.c
@@ -100,12 +100,8 @@ static const char *comsat_argp_capa[] = {
#define NOT_HERE 1
#define PERMISSION_DENIED 2
-#ifndef MAXHOSTNAMELEN
-# define MAXHOSTNAMELEN 64
-#endif
-
int maxlines = 5;
-char hostname[MAXHOSTNAMELEN];
+char *hostname;
const char *username;
int require_tty;
mu_m_server_t server;
@@ -220,11 +216,17 @@ sig_hup (int sig)
void
comsat_init ()
{
+ int rc;
+
/* Register mailbox formats */
mu_register_all_mbox_formats ();
- gethostname (hostname, sizeof hostname);
-
+ rc = mu_get_host_name (&hostname);
+ if (rc)
+ {
+ mu_diag_funcall (MU_DIAG_ERROR, "mu_get_host_name", NULL, rc);
+ exit (EXIT_FAILURE);
+ }
/* Set signal handlers */
signal (SIGTTOU, SIG_IGN);
signal (SIGCHLD, SIG_IGN);
@@ -586,7 +588,7 @@ main (int argc, char **argv)
if (mu_app_init (&argp, comsat_argp_capa, comsat_cfg_param, argc, argv, 0,
&ind, server))
- exit (1);
+ exit (EXIT_FAILURE);
if (test_mode)
{

Return to:

Send suggestions and report system problems to the System administrator.