projects
/
suckless
/
slstatus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1289bdb
)
On success, fgets always terminates the result.
author
Tobias Stoeckmann
<tobias@stoeckmann.org>
Tue, 4 Apr 2017 19:27:31 +0000
(21:27 +0200)
committer
Tobias Stoeckmann
<tobias@stoeckmann.org>
Tue, 4 Apr 2017 19:27:31 +0000
(21:27 +0200)
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>
slstatus.c
patch
|
blob
|
history
diff --git
a/slstatus.c
b/slstatus.c
index 6deb68cf82c9a0e8860335c08ed0d244a0155ac5..ada64418899eb040f70a4f4433a9936c4166aac8 100644
(file)
--- 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';