From d11b2e655baac3e477c400aadeefa39d91558dc4 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Tue, 1 Jun 1999 15:01:19 +0000 Subject: Use the hostname instead of the empty string for %canon% if we can't canonicalize the hostname. --- zwgc/subscriptions.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'zwgc') diff --git a/zwgc/subscriptions.c b/zwgc/subscriptions.c index 5b0567b..c319729 100644 --- a/zwgc/subscriptions.c +++ b/zwgc/subscriptions.c @@ -222,16 +222,17 @@ char ourhost[MAXHOSTNAMELEN],ourhostcanon[MAXHOSTNAMELEN]; static void inithosts() { struct hostent *hent; - if (gethostname(ourhost,sizeof(ourhost)-1) == -1) { + if (gethostname(ourhost, sizeof(ourhost)-1) == -1) { ERROR3("unable to retrieve hostname, %s and %s will be wrong in subscriptions.\n", TOKEN_HOSTNAME, TOKEN_CANONNAME); return; } if (!(hent = gethostbyname(ourhost))) { ERROR2("unable to resolve hostname, %s will be wrong in subscriptions.\n", TOKEN_CANONNAME); + strncpy(ourhostcanon, ourhost, sizeof(ourhostcanon)-1); return; } - (void) strncpy(ourhostcanon,hent->h_name, sizeof(ourhostcanon)-1); + strncpy(ourhostcanon, hent->h_name, sizeof(ourhostcanon)-1); return; } -- cgit v1.2.3