commit 56fffbce64e2ee66891dbe3f2b8b9b4f9cb284bc
parent 6edc959933cc0a8c94ed4571bf668a5fe15ba7aa
Author: Ali H. Fardan <raiz@firemail.cc>
Date: Wed, 14 Sep 2016 12:22:03 +0300
improved hostname()
Diffstat:
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/slstatus.c b/slstatus.c
@@ -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);