diff --git a/usr.bin/head/head.c b/usr.bin/head/head.c index 3c4865b79076..9c1359184313 100644 --- a/usr.bin/head/head.c +++ b/usr.bin/head/head.c @@ -113,7 +113,7 @@ head(fp, cnt) { register int ch; - while ((ch = getc(fp)) != EOF && cnt) { + while (cnt && (ch = getc(fp)) != EOF) { if (putchar(ch) == EOF) err(1, "stdout: %s", strerror(errno)); if (ch == '\n')