1
0
Fork 0

improved hostname()

This commit is contained in:
Ali H. Fardan 2016-09-14 12:22:03 +03:00
parent 6edc959933
commit 56fffbce64

View file

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