From: torrinfail Date: Sun, 27 Dec 2020 20:43:03 +0000 (-0700) Subject: Merge pull request #40 from IGeraGera/IGeraGera-patch-1 X-Git-Url: https://git.armaanb.net/?p=dwmblocks.git;a=commitdiff_plain;h=96cbb453e5373c05372fd4bf3faacfa53e409067;hp=5583a44cd3821e9a645b9eb8ad76e918385621f2 Merge pull request #40 from IGeraGera/IGeraGera-patch-1 Updated the patch in README.md for commit b6b0be4 --- diff --git a/Makefile b/Makefile index 8b3a30e..ef43ef4 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ PREFIX ?= /usr/local CC ?= cc +LDFLAGS = -lX11 output: dwmblocks.c blocks.def.h blocks.h - ${CC} `pkg-config --cflags x11 --libs x11` dwmblocks.c -o dwmblocks + ${CC} dwmblocks.c $(LDFLAGS) -o dwmblocks blocks.h: cp blocks.def.h $@ 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;