Replace while(true) loop with do ... while()

This commit is contained in:
Camden Dixie O'Brien 2022-10-15 20:23:07 +01:00
parent 2f7fe23ee9
commit e269430d13

7
main.c
View File

@ -361,7 +361,7 @@ int main(int argc, char *argv[])
* endings is done with a buffered reading approach to
* minimize syscalls (as opposed to using fgetc()).
*/
while (true) {
do {
/* Fill fbuf from file. */
n = fread(fbuf, sizeof(*fbuf), FBUF_SIZE, rf);
if (n != FBUF_SIZE && ferror(rf)) {
@ -386,10 +386,7 @@ int main(int argc, char *argv[])
rbuf[rlen++] = fbuf[fpos];
}
}
if (feof(rf))
break;
}
} while (!feof(rf));
fclose(rf);
} else if (S_ISDIR(rstat.st_mode)) {