Fix count so that it doesn't make an extra fread call after
authorDan Gohman <gohman@apple.com>
Mon, 31 May 2010 16:13:45 +0000 (16:13 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 31 May 2010 16:13:45 +0000 (16:13 +0000)
EOF is detected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105223 91177308-0d34-0410-b5e6-96231b3b80d8

utils/count/count.c

index a37e1e0b25480f46ccebd655654e67639e82389a..13250198b9e4d7d29262a8c0ab643f85e020e134 100644 (file)
@@ -26,7 +26,7 @@ int main(int argc, char **argv) {
   }
 
   NumLines = 0;
-  while ((NumRead = fread(Buffer, 1, sizeof(Buffer), stdin)){
+  while ((NumRead = fread(Buffer, 1, sizeof(Buffer), stdin)) == sizeof(Buffer)){
     unsigned i;
 
     for (i = 0; i != NumRead; ++i)