diff options
| author | Joerg Wunsch <joerg@FreeBSD.org> | 1995-08-15 19:34:11 +0000 |
|---|---|---|
| committer | Joerg Wunsch <joerg@FreeBSD.org> | 1995-08-15 19:34:11 +0000 |
| commit | 8e502f1158e4c49410f1ee249cecc258a4bd73ae (patch) | |
| tree | 8c8815f3ef8d028770e6485888351389c6c66bbe /usr.bin/head | |
| parent | a722b904d7291701b49c992d12d445486dfb5dd5 (diff) | |
Notes
Diffstat (limited to 'usr.bin/head')
| -rw-r--r-- | usr.bin/head/head.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.bin/head/head.c b/usr.bin/head/head.c index e33a3c26a459..3c4865b79076 100644 --- a/usr.bin/head/head.c +++ b/usr.bin/head/head.c @@ -113,12 +113,11 @@ head(fp, cnt) { register int ch; - while (cnt--) - while ((ch = getc(fp)) != EOF) { + while ((ch = getc(fp)) != EOF && cnt) { if (putchar(ch) == EOF) err(1, "stdout: %s", strerror(errno)); if (ch == '\n') - break; + cnt--; } } |
