summaryrefslogtreecommitdiff
path: root/slstatus.c
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2017-04-04 21:27:31 +0200
committerTobias Stoeckmann <tobias@stoeckmann.org>2017-04-04 21:27:31 +0200
commit35295f190207d9001fdcf30fe76f11434691b259 (patch)
tree59c7b103bb8200dda5fade062de850929714aabc /slstatus.c
parent1289bdb742adab134cf4874447b66ab386deb724 (diff)
On success, fgets always terminates the result.
If fgets succeeds, then the resulting char array is always terminated by a '\0'. No need to keep extra space, therefore sizeof(buf) is the correct argument. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Diffstat (limited to 'slstatus.c')
-rw-r--r--slstatus.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/slstatus.c b/slstatus.c
index 6deb68c..ada6441 100644
--- a/slstatus.c
+++ b/slstatus.c
@@ -447,7 +447,7 @@ run_command(const char *cmd)
warn("Failed to get command output for %s", cmd);
return smprintf("%s", UNKNOWN_STR);
}
- fgets(buf, sizeof(buf) - 1, fp);
+ fgets(buf, sizeof(buf), fp);
pclose(fp);
buf[sizeof(buf) - 1] = '\0';