summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortorrinfail <torrinfail@gmail.com>2020-12-24 16:53:26 -0700
committerGitHub <noreply@github.com>2020-12-24 16:53:26 -0700
commit0e22e81b1e952e13534d7e5068be57a4d8396d87 (patch)
tree3d90894d5536e98700119a4631566a513c084fbb
parent5b8eb5f7b146db4a2089fe1ca96b243a5c471e84 (diff)
parent4c392c32ed90d6cee2f771664852179d225eedc9 (diff)
Merge pull request #39 from Strahinja/master
Add the call to pclose() when the output from the block command is empty
-rw-r--r--dwmblocks.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/dwmblocks.c b/dwmblocks.c
index 64ad7a3..ded717c 100644
--- a/dwmblocks.c
+++ b/dwmblocks.c
@@ -65,8 +65,11 @@ void getcmd(const Block *block, char *output)
int i = strlen(block->icon);
fgets(output+i, CMDLENGTH-i-delimLen, cmdf);
i = strlen(output);
- if (i == 0)//return if block and command output are both empty
+ if (i == 0) {
+ //return if block and command output are both empty
+ pclose(cmdf);
return;
+ }
if (delim[0] != '\0') {
//only chop off newline if one is present at the end
i = output[i-1] == '\n' ? i-1 : i;