svn commit: trunk/busybox/sysklogd

vda at busybox.net vda at busybox.net
Sat Feb 23 12:08:36 UTC 2008


Author: vda
Date: 2008-02-23 04:08:36 -0800 (Sat, 23 Feb 2008)
New Revision: 21093

Log:
syslogd: small shrink



Modified:
   trunk/busybox/sysklogd/syslogd.c


Changeset:
Modified: trunk/busybox/sysklogd/syslogd.c
===================================================================
--- trunk/busybox/sysklogd/syslogd.c	2008-02-23 11:54:37 UTC (rev 21092)
+++ trunk/busybox/sysklogd/syslogd.c	2008-02-23 12:08:36 UTC (rev 21093)
@@ -647,10 +647,10 @@
 		option_mask32 |= OPT_locallog;
 
 	/* Store away localhost's name before the fork */
-	gethostname(G.localHostName, sizeof(G.localHostName));
 	/* "It is unspecified whether the truncated hostname
-	 * will be null-terminated". Idiots! */
-	G.localHostName[sizeof(G.localHostName) - 1] = '\0';
+	 * will be null-terminated". We give it (size - 1),
+	 * thus last byte will be NUL no matter what. */
+	gethostname(G.localHostName, sizeof(G.localHostName) - 1);
 	*strchrnul(G.localHostName, '.') = '\0';
 
 	if (!(option_mask32 & OPT_nofork)) {




More information about the busybox-cvs mailing list