]> git.armaanb.net Git - dwmblocks.git/commitdiff
Added the call to pclose() when the output from the command is empty
authorСтрахиња Радић <contact@strahinja.org>
Wed, 18 Nov 2020 11:09:15 +0000 (12:09 +0100)
committerСтрахиња Радић <contact@strahinja.org>
Wed, 18 Nov 2020 11:09:15 +0000 (12:09 +0100)
dwmblocks.c

index 64ad7a33e2d6b6acf39f28b899e1a74a23be9cee..ded717c197508c0453a36a562e82574fccb8ef49 100644 (file)
@@ -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);
        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;
                return;
+       }
        if (delim[0] != '\0') {
                //only chop off newline if one is present at the end
                i = output[i-1] == '\n' ? i-1 : i;
        if (delim[0] != '\0') {
                //only chop off newline if one is present at the end
                i = output[i-1] == '\n' ? i-1 : i;