Replace while(true) loop with do ... while()
This commit is contained in:
parent
2f7fe23ee9
commit
e269430d13
7
main.c
7
main.c
@ -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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user