llvm.org GIT mirror llvm / c6e1f67
Fix extra fread after EOF, non-wires-crossed version. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105270 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 9 years ago
1 changed file(s) with 4 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
2525 }
2626
2727 NumLines = 0;
28 while ((NumRead = fread(Buffer, 1, sizeof(Buffer), stdin))) {
28 do {
2929 unsigned i;
30
31 NumRead = fread(Buffer, 1, sizeof(Buffer), stdin);
3032
3133 for (i = 0; i != NumRead; ++i)
3234 if (Buffer[i] == '\n')
3335 ++NumLines;
34 }
36 } while (NumRead == sizeof(Buffer));
3537
3638 if (!feof(stdin)) {
3739 fprintf(stderr, "%s: error reading stdin\n", argv[0]);