diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-19 01:10:20 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-19 01:10:20 +0000 |
commit | 92657d484f4f95ce4579ad095c9caf596a737e5b (patch) | |
tree | deded9ccc14fc9bbcff10db7ea9dd72136653b84 | |
parent | e8419c90f1f3880f96ff335c4ee0bdd7a86ab0c6 (diff) | |
download | busybox-w32-92657d484f4f95ce4579ad095c9caf596a737e5b.tar.gz busybox-w32-92657d484f4f95ce4579ad095c9caf596a737e5b.tar.bz2 busybox-w32-92657d484f4f95ce4579ad095c9caf596a737e5b.zip |
syslogd: tighten up hostname handling.
-rw-r--r-- | sysklogd/syslogd.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index dc5e6250a..bed18168c 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -649,10 +649,10 @@ int syslogd_main(int argc, char **argv) | |||
649 | 649 | ||
650 | /* Store away localhost's name before the fork */ | 650 | /* Store away localhost's name before the fork */ |
651 | gethostname(G.localHostName, sizeof(G.localHostName)); | 651 | gethostname(G.localHostName, sizeof(G.localHostName)); |
652 | p = strchr(G.localHostName, '.'); | 652 | /* "It is unspecified whether the truncated hostname |
653 | if (p) { | 653 | * will be null-terminated". Idiots! */ |
654 | *p = '\0'; | 654 | G.localHostName[sizeof(G.localHostName) - 1] = '\0'; |
655 | } | 655 | *strchrnul(G.localHostName, '.') = '\0'; |
656 | 656 | ||
657 | if (!(option_mask32 & OPT_nofork)) { | 657 | if (!(option_mask32 & OPT_nofork)) { |
658 | bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv); | 658 | bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv); |