cvs commit: src/bin/cat

Jason Smethers jason at smethers.net
Sun Nov 7 06:24:59 PST 2004


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





More information about the Commits mailing list