summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Marcher <info@nulltime.net>2016-10-10 09:02:24 +0200
committerAaron Marcher <info@nulltime.net>2016-10-10 09:02:24 +0200
commit5a70f920f04f1bfc2df959d2ae131f511b7c8e38 (patch)
tree3a64646d57c0e97a3aa85101b18c1ae141c911a2
parentcc1bb3a3445696466e9be24f4dae0d9453896eb0 (diff)
fixed run_command()
-rw-r--r--slstatus.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/slstatus.c b/slstatus.c
index e7c1c3f..9272c54 100644
--- a/slstatus.c
+++ b/slstatus.c
@@ -407,8 +407,8 @@ run_command(const char *cmd)
warn("Failed to get command output for %s", cmd);
return smprintf(UNKNOWN_STR);
}
- fgets(buf, sizeof(buf), fp);
- buf[sizeof(buf)-1] = '\0';
+ fgets(buf, sizeof(buf)-1, fp);
+ buf[strlen(buf)-1] = '\0';
pclose(fp);
return smprintf("%s", buf);