aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysklogd/syslogd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 0d98351fe..c71350750 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -647,10 +647,10 @@ int syslogd_main(int argc, char **argv)
647 option_mask32 |= OPT_locallog; 647 option_mask32 |= OPT_locallog;
648 648
649 /* Store away localhost's name before the fork */ 649 /* Store away localhost's name before the fork */
650 gethostname(G.localHostName, sizeof(G.localHostName));
651 /* "It is unspecified whether the truncated hostname 650 /* "It is unspecified whether the truncated hostname
652 * will be null-terminated". Idiots! */ 651 * will be null-terminated". We give it (size - 1),
653 G.localHostName[sizeof(G.localHostName) - 1] = '\0'; 652 * thus last byte will be NUL no matter what. */
653 gethostname(G.localHostName, sizeof(G.localHostName) - 1);
654 *strchrnul(G.localHostName, '.') = '\0'; 654 *strchrnul(G.localHostName, '.') = '\0';
655 655
656 if (!(option_mask32 & OPT_nofork)) { 656 if (!(option_mask32 & OPT_nofork)) {