slstatus

My fork of https://tools.suckless.org/slstatus/
git clone https://git.inz.fi/slstatus
Log | Files | Refs | README | LICENSE

commit 35295f190207d9001fdcf30fe76f11434691b259
parent 1289bdb742adab134cf4874447b66ab386deb724
Author: Tobias Stoeckmann <tobias@stoeckmann.org>
Date:   Tue,  4 Apr 2017 21:27:31 +0200

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:
Mslstatus.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 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';