summaryrefslogtreecommitdiff
path: root/comsat/comsat.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-10-05 15:37:48 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2010-10-05 15:37:48 +0300
commitc5cc666d68f00af1bbe8e13c2c7a8bd0b224d891 (patch)
tree6c0b06c3d8a742c3d2cb0d1441eb24c5bea14383 /comsat/comsat.c
parentdf67a458159e4bbfcfd59248091182e55aaa0a9a (diff)
downloadmailutils-c5cc666d68f00af1bbe8e13c2c7a8bd0b224d891.tar.gz
mailutils-c5cc666d68f00af1bbe8e13c2c7a8bd0b224d891.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. * libmailutils/locker.c (lock_dotlock): Use mu_get_host_name. * libmailutils/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 4ec589b55..0b511fa0a 100644
--- a/comsat/comsat.c
+++ b/comsat/comsat.c
@@ -97,12 +97,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;
@@ -190,11 +186,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);
@@ -556,7 +558,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.