syslogd: tighten up hostname handling.
This commit is contained in:
parent
e8419c90f1
commit
92657d484f
@ -649,10 +649,10 @@ int syslogd_main(int argc, char **argv)
|
|||||||
|
|
||||||
/* Store away localhost's name before the fork */
|
/* Store away localhost's name before the fork */
|
||||||
gethostname(G.localHostName, sizeof(G.localHostName));
|
gethostname(G.localHostName, sizeof(G.localHostName));
|
||||||
p = strchr(G.localHostName, '.');
|
/* "It is unspecified whether the truncated hostname
|
||||||
if (p) {
|
* will be null-terminated". Idiots! */
|
||||||
*p = '\0';
|
G.localHostName[sizeof(G.localHostName) - 1] = '\0';
|
||||||
}
|
*strchrnul(G.localHostName, '.') = '\0';
|
||||||
|
|
||||||
if (!(option_mask32 & OPT_nofork)) {
|
if (!(option_mask32 & OPT_nofork)) {
|
||||||
bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv);
|
bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv);
|
||||||
|
Loading…
Reference in New Issue
Block a user