From: John Hodge Date: Sun, 10 Feb 2013 01:43:36 +0000 (+0800) Subject: Usermode/cat - Fixed order of fread/fwrite params X-Git-Tag: rel0.15~577 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=62e6e55290bacfb4bdc4a8d6b63db05467dc368b;p=tpg%2Facess2.git Usermode/cat - Fixed order of fread/fwrite params --- diff --git a/Usermode/Applications/cat_src/main.c b/Usermode/Applications/cat_src/main.c index 3fae4c6c..45a8d1b3 100644 --- a/Usermode/Applications/cat_src/main.c +++ b/Usermode/Applications/cat_src/main.c @@ -12,7 +12,7 @@ */ int main(int argc, char *argv[]) { - int num; + size_t num; char buf[BUF_SIZE]; if(argc < 2) { @@ -27,9 +27,9 @@ int main(int argc, char *argv[]) } do { - num = fread(buf, BUF_SIZE, 1, fp); - if(num < 0) break; - fwrite(buf, num, 1, stdout); + num = fread(buf, 1, BUF_SIZE, fp); + if(num <= 0) break; + fwrite(buf, 1, num, stdout); } while(num == BUF_SIZE); fclose(fp);