From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 7 16:58:30 2008 Return-Path: Delivered-To: hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C3471065682; Thu, 7 Aug 2008 16:58:30 +0000 (UTC) (envelope-from gabor@kovesdan.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id B51EB8FC14; Thu, 7 Aug 2008 16:58:29 +0000 (UTC) (envelope-from gabor@kovesdan.org) Received: from localhost (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 196B814D6BC4; Thu, 7 Aug 2008 18:58:29 +0200 (CEST) X-Virus-Scanned: amavisd-new at t-hosting.hu Received: from server.mypc.hu ([127.0.0.1]) by localhost (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id uLKJRmClqa+5; Thu, 7 Aug 2008 18:58:27 +0200 (CEST) Received: from [192.168.1.146] (catv-50629c59.catv.broadband.hu [80.98.156.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id 2AB4314D6BBC; Thu, 7 Aug 2008 18:58:25 +0200 (CEST) Message-ID: <489B29A9.1090609@kovesdan.org> Date: Thu, 07 Aug 2008 18:58:17 +0200 From: Gabor Kovesdan User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: "Sean C. Farley" References: <489B0ACD.80008@kovesdan.org> <489B22BD.5050109@kovesdan.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Thu, 07 Aug 2008 17:39:10 +0000 Cc: fjoe@FreeBSD.org, hackers@FreeBSD.org Subject: Re: strange issue reading /dev/null X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Aug 2008 16:58:30 -0000 Sean C. Farley ha scritto: > On Thu, 7 Aug 2008, Gabor Kovesdan wrote: > >> Sean C. Farley ha scritto: >>> You are testing c which has not been set. It works OK if you set c >>> then do the test: >>> >>> + c = fgetc(f); >>> if (c != EOF) >>> - printf("%c\n", fgetc(f)); >>> + printf("%c\n", c); >> Yes, you are right, this is what I meant, I'm just a bit >> disorganised.... >> Thanks! > > You are welcome. > > Actually, what I found odd was that the base gcc did not warn about > using an uninitialized variable using -Wall. > > Obviously, test fopen() and fgetc() return codes correctly as others > have noted. I just assume you were not in your test program. Actaually, I wanted to track down why BSD grep echoed the y with the diaresis when I executed grep .