mirror of
https://github.com/pikami/slstatus.git
synced 2024-11-27 22:05:42 +00:00
fixed run_command()
This commit is contained in:
parent
5a70f920f0
commit
6890a27a3a
@ -400,7 +400,7 @@ static char *
|
||||
run_command(const char *cmd)
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[64] = "n/a";
|
||||
char buf[1024] = "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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user