DragonFly BSD
DragonFly commits List (threaded) for 2004-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cvs commit: src/bin/cat


From: Jason Smethers <jason@xxxxxxxxxxxx>
Date: Sun, 07 Nov 2004 08:24:59 -0600

Liam J. Foy wrote:
liamfoy 2004/11/04 13:31:37 PST

DragonFly src repository

Modified files:
bin/cat cat.c Log:
- Remove unnecessary selection statement to see if buf == NULL.
- Don't use fileno to get stdout, just use STDOUT_FILENO
- Fix malloc err message
OK'ed by: Joerg and Jeroen
Revision Changes Path
1.12 +8 -10 src/bin/cat/cat.c



http://www.dragonflybsd.org/cvsweb/src/bin/cat/cat.c.diff?r1=1.11&r2=1.12&f=u


Removing the check for (buf == NULL):
1. Introduces a memory leak -- equal to (bsize * (n - 1)) where n is the number of times raw_cat is called.
2. Adds unecessary work -- stdout never changes



Also, the constant 1024 in the buffer size check should be replaced by the posix constant BUFSIZ.


- Jason



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]