Audit head(1)
1) Use (s)size_t in head(). 2) BUGFIX: only check buf[len - 1] when len > 0, else there would be an overflow when getline returns 0 (which can happen) and a very potential segmentation fault. 3) fix error-messages. 4) update usage(). 5) argv-argc-style. 6) clear up the main loop with if (newline). 7) add newline before return.
This commit is contained in:
Reference in New Issue
Block a user