From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3716 invoked by alias); 23 Apr 2009 20:37:20 -0000 Received: (qmail 3702 invoked by uid 22791); 23 Apr 2009 20:37:20 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Apr 2009 20:37:15 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id AFD602BACB1; Thu, 23 Apr 2009 16:37:13 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 74LSGAiUrNrW; Thu, 23 Apr 2009 16:37:13 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 764292BAB46; Thu, 23 Apr 2009 16:37:13 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 648DEF5924; Thu, 23 Apr 2009 13:37:10 -0700 (PDT) Date: Thu, 23 Apr 2009 20:37:00 -0000 From: Joel Brobecker To: Mark Kettenis Cc: gdb-patches@sourceware.org Subject: Re: [RFA/commit] Handle EOF on terminals opened with ENONBLOCK... Message-ID: <20090423203710.GH7552@adacore.com> References: <20090423191446.GB7512@adacore.com> <200904231934.n3NJY7j7006691@brahms.sibelius.xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200904231934.n3NJY7j7006691@brahms.sibelius.xs4all.nl> User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-04/txt/msg00664.txt.bz2 > I suppose the errno == EAGAIN is supposed to check whether fgetc() > failed. However, your code has an ferror() in between, which could > clobber errno. So perhaps it is better to reverse those checks. I did it in that order because I wanted to test the error condition on the FILE before actually checking errno. The C99 draft that I have does not say anything about errno, but the man page on my GNU/Linux machine does say explicitly that errno doesn't get set during a call to ferror. I can try reversing them, though... Let me know if you think I should. -- Joel