From 4c392c32ed90d6cee2f771664852179d225eedc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D1=80=D0=B0=D1=85=D0=B8=D1=9A=D0=B0=20=D0=A0?= =?UTF-8?q?=D0=B0=D0=B4=D0=B8=D1=9B?= Date: Wed, 18 Nov 2020 12:09:15 +0100 Subject: Added the call to pclose() when the output from the command is empty --- dwmblocks.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3