Merge pull request #17 from R41z/master

improved hostname()
This commit is contained in:
Aaron Marcher 2016-09-14 11:27:19 +02:00 committed by GitHub
commit 5609b9d9de

View File

@ -272,9 +272,7 @@ hostname(void)
}
fgets(hostname, sizeof(hostname), fp);
/* FIXME: needs improvement */
memset(&hostname[strlen(hostname)-1], '\0',
sizeof(hostname) - strlen(hostname));
hostname[strlen(hostname)-1] = '\0';
fclose(fp);
return smprintf("%s", hostname);