aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;