X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 	tests=AWL,BAYES_00,J_CHICKENPOX_44,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <49DAEA8E.8040902@gmail.com>
Date: Tue, 07 Apr 2009 06:54:22 +0100
From: Dave Korn <dave.korn.cygwin@googlemail.com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: cygwin 1.7 fstat weirdness
References: <75cc17ac0904061246y54f76f40h6611dc982f0a7bdc@mail.gmail.com> 	 <20090406201123.GT852@calimero.vinschen.de> <17393e3e0904061938n54e14997o4e28ce5ce1876e4e@mail.gmail.com>
In-Reply-To: <17393e3e0904061938n54e14997o4e28ce5ce1876e4e@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Matt Wozniski wrote:
> On Mon, Apr 6, 2009 at 4:11 PM, Corinna Vinschen wrote:
>> On Apr  6 14:46, Gregg Reynolds wrote:
>>>   int fd = path ? open(path, O_RDONLY, TCFILEMODE) : 0;  // path = "Makefile"
>> Is fd == 0 by any chance?  The above code silently sets fd to 0 if it
>> can't open path.
> 
> Unless I'm missing something, that code sets fd to 0 if path is
> NULL... which doesn't seem to make any sense at all, since 0 is a
> valid file descriptor number...

  I often do exactly that when I'm writing a commandline utility that can take
an option to direct output to a file and otherwise writes it to stdout.
(However I agree that that's probably not what is going on in this situation).

    cheers,
      DaveK



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

