From 56fffbce64e2ee66891dbe3f2b8b9b4f9cb284bc Mon Sep 17 00:00:00 2001 From: "Ali H. Fardan" Date: Wed, 14 Sep 2016 12:22:03 +0300 Subject: improved hostname() --- slstatus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/slstatus.c b/slstatus.c index 572f964..fefdf6f 100644 --- 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); -- cgit v1.2.3