From fc80bd975c264959a73e074bc2ff49c52c384ac3 Mon Sep 17 00:00:00 2001 From: dfuehrer Date: Tue, 23 Mar 2021 18:29:19 -0700 Subject: [PATCH] reset errno so previous error doesn't cause next check to fail --- dwmblocks.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dwmblocks.c b/dwmblocks.c index bbfad2d..0a0644f 100644 --- a/dwmblocks.c +++ b/dwmblocks.c @@ -97,11 +97,10 @@ void getcmd(const Block *block, char *output) char * s; int e; do { + errno = 0; s = fgets(tmpstr, CMDLENGTH-(strlen(delim)+1), cmdf); e = errno; } while (!s && e == EINTR); - // this is equivalent but less readable and stuff - //while(!fgets(tmpstr, CMDLENGTH-(strlen(delim)+1), cmdf) && errno == EINTR); pclose(cmdf); int i = strlen(block->icon); strcpy(output, block->icon);