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:
5a70f92
)
fixed run_command()
author
Aaron Marcher
<info@nulltime.net>
Mon, 10 Oct 2016 07:19:44 +0000
(09:19 +0200)
committer
Aaron Marcher
<info@nulltime.net>
Mon, 10 Oct 2016 07:19:44 +0000
(09:19 +0200)
slstatus.c
patch
|
blob
|
history
diff --git
a/slstatus.c
b/slstatus.c
index 9272c5419f27bdb6a7ffa7f2c938fcc7a0d5abfc..57ef9a9af9f73b268d47bd5b1f3e516767c5e309 100644
(file)
--- a/
slstatus.c
+++ b/
slstatus.c
@@
-400,7
+400,7
@@
static char *
run_command(const char *cmd)
{
FILE *fp;
- char buf[
6
4] = "n/a";
+ char buf[
102
4] = "n/a";
fp = popen(cmd, "r");
if (fp == NULL) {
@@
-408,9
+408,11
@@
run_command(const char *cmd)
return smprintf(UNKNOWN_STR);
}
fgets(buf, sizeof(buf)-1, fp);
- buf[strlen(buf)-1] = '\0';
pclose(fp);
+ buf[strlen(buf)] = '\0';
+ strtok(buf, "\n");
+
return smprintf("%s", buf);
}