From: bluhm Date: Sun, 19 Sep 2021 10:17:36 +0000 (+0000) Subject: The LocalDomain in syslogd(8) is not used, remove variable. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=dfa08134e20e7abe3833a133512d0c107cf98e7f;p=openbsd The LocalDomain in syslogd(8) is not used, remove variable. Use RFC 5424 NILVALUE as fallback for LocalHostName. OK millert@ mvs@ --- diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 546c0531b42..a9f4d0f8ae8 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syslogd.c,v 1.269 2021/09/10 15:18:36 bluhm Exp $ */ +/* $OpenBSD: syslogd.c,v 1.270 2021/09/19 10:17:36 bluhm Exp $ */ /* * Copyright (c) 2014-2021 Alexander Bluhm @@ -218,7 +218,6 @@ struct filed consfile; int Debug; /* debug flag */ int Foreground; /* run in foreground, instead of daemonizing */ char LocalHostName[HOST_NAME_MAX+1]; /* our hostname */ -char *LocalDomain; /* our local domain name */ int Started = 0; /* set after privsep */ int Initialized = 0; /* set when we have initialized ourselves */ @@ -507,12 +506,11 @@ main(int argc, char *argv[]) if (consfile.f_file == -1) log_warn("open %s", consfile.f_un.f_fname); - (void)gethostname(LocalHostName, sizeof(LocalHostName)); - if ((p = strchr(LocalHostName, '.')) != NULL) { - *p++ = '\0'; - LocalDomain = p; - } else - LocalDomain = ""; + if (gethostname(LocalHostName, sizeof(LocalHostName)) == -1 || + LocalHostName[0] == '\0') + strlcpy(LocalHostName, "-", sizeof(LocalHostName)); + else if ((p = strchr(LocalHostName, '.')) != NULL) + *p = '\0'; /* Reserve space for kernel message buffer plus buffer full message. */ linesize = getmsgbufsize() + 64;