← Commit list

a7259b64e

Denis Vlasenko
Denis Vlasenko
2008-02-23
FAILED Duration: 17s

Subject

syslogd: small shrink

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

sysklogd/syslogd.c+3 -3
@@ -647,10 +647,10 @@ int syslogd_main(int argc, char **argv)
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)) {