From owner-freebsd-bugs Sat Aug 12 16:00:02 1995 Return-Path: bugs-owner Received: (from majordom@localhost) by freefall.FreeBSD.org (8.6.11/8.6.6) id QAA25334 for bugs-outgoing; Sat, 12 Aug 1995 16:00:02 -0700 Received: (from gnats@localhost) by freefall.FreeBSD.org (8.6.11/8.6.6) id QAA25327 ; Sat, 12 Aug 1995 16:00:02 -0700 Resent-Date: Sat, 12 Aug 1995 16:00:02 -0700 Resent-Message-Id: <199508122300.QAA25327@freefall.FreeBSD.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, wosch@cs.tu-berlin.de Received: from who.cdrom.com (who.cdrom.com [192.216.222.3]) by freefall.FreeBSD.org (8.6.11/8.6.6) with ESMTP id PAA25264 for ; Sat, 12 Aug 1995 15:54:37 -0700 Received: from mail.cs.tu-berlin.de (mail.cs.tu-berlin.de [130.149.17.13]) by who.cdrom.com (8.6.11/8.6.11) with ESMTP id PAA11731 for ; Sat, 12 Aug 1995 15:54:29 -0700 Received: from localhost.cs.tu-berlin.de ([130.149.1.128]) by mail.cs.tu-berlin.de (8.6.12/8.6.12) with ESMTP id AAA15426 for ; Sun, 13 Aug 1995 00:50:58 +0200 Received: (from wosch@localhost) by localhost (8.6.9/8.6.9) id AAA01206; Sun, 13 Aug 1995 00:46:18 +0200 Message-Id: <199508122246.AAA01206@localhost> Date: Sun, 13 Aug 1995 00:46:18 +0200 From: Wolfram Schneider Reply-To: wosch@cs.tu-berlin.de To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/678: head(1) ignore EOF Sender: bugs-owner@freebsd.org Precedence: bulk >Number: 678 >Category: bin >Synopsis: head(1) ignore EOF >Confidential: yes >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Aug 12 16:00:01 PDT 1995 >Last-Modified: >Originator: Wolfram Schneider >Organization: >Release: FreeBSD 2.0-ALPHA i386 >Environment: >Description: head(1) ignore EOF >How-To-Repeat: $ echo "one line" > /tmp/foo $ head -100000000000 /tmp/foo ^C >Fix: --- 1.1 1995/08/12 22:14:38 +++ head.c 1995/08/12 22:18:58 @@ -113,12 +113,11 @@ { 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--; } } >Audit-Trail: >Unformatted: