diff options
author | Greg Hudson <ghudson@mit.edu> | 1999-06-01 15:01:19 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 1999-06-01 15:01:19 +0000 |
commit | d11b2e655baac3e477c400aadeefa39d91558dc4 (patch) | |
tree | ef73d283dea3ea33a76862a0c849fb6197c6239c /zwgc | |
parent | 69b1ec66ce66e45037c4db3db95ede366c44efd0 (diff) |
Use the hostname instead of the empty string for %canon% if we can't
canonicalize the hostname.
Diffstat (limited to 'zwgc')
-rw-r--r-- | zwgc/subscriptions.c | 5 |
1 files changed, 3 insertions, 2 deletions
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; } |