From owner-freebsd-standards@FreeBSD.ORG Sat May 21 19:36:10 2005 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3A7C416A4CF for ; Sat, 21 May 2005 19:36:10 +0000 (GMT) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.FreeBSD.org (Postfix) with ESMTP id 38F9A43D68 for ; Sat, 21 May 2005 19:36:06 +0000 (GMT) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) j4LJa5bJ060389 for ; Sat, 21 May 2005 12:36:05 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost)j4LJa5wV060388 for freebsd-standards@freebsd.org; Sat, 21 May 2005 12:36:05 -0700 (PDT) (envelope-from sgk) Date: Sat, 21 May 2005 12:36:05 -0700 From: Steve Kargl To: freebsd-standards@freebsd.org Message-ID: <20050521193605.GB51782@troutmask.apl.washington.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i Subject: Read /dev/null differs from POSIX X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 May 2005 19:36:10 -0000 >From http://www.opengroup.org/onlinepubs/009695399/toc.htm /dev/null -- An infinite data source and data sink. Data written to /dev/null shall be discarded. Reads from /dev/null shall always return end-of-file (EOF). This program #include int main(void) { int i=0,j; FILE *fp; fp = fopen("/dev/null", "r"); while(fread(&j, sizeof(int), 1, fp) != 1) { i++; if (i == 5) break; } printf("i = %d\n", i); if (j == EOF) printf("EOF\n"); else printf("j = %d\n", j); } prints i = 5 j = 1 Is this historic BSD defacto behavior? -- Steve