reset errno so previous error doesn't cause next check to fail

This commit is contained in:
dfuehrer 2021-03-23 18:29:19 -07:00
parent d474ad1d67
commit fc80bd975c

View file

@ -97,11 +97,10 @@ void getcmd(const Block *block, char *output)
char * s; char * s;
int e; int e;
do { do {
errno = 0;
s = fgets(tmpstr, CMDLENGTH-(strlen(delim)+1), cmdf); s = fgets(tmpstr, CMDLENGTH-(strlen(delim)+1), cmdf);
e = errno; e = errno;
} while (!s && e == EINTR); } while (!s && e == EINTR);
// this is equivalent but less readable and stuff
//while(!fgets(tmpstr, CMDLENGTH-(strlen(delim)+1), cmdf) && errno == EINTR);
pclose(cmdf); pclose(cmdf);
int i = strlen(block->icon); int i = strlen(block->icon);
strcpy(output, block->icon); strcpy(output, block->icon);