delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/04/07/01:44:17

X-Recipient: archive-cygwin AT delorie DOT 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 DOT korn DOT cygwin AT googlemail DOT com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: cygwin 1.7 fstat weirdness
References: <75cc17ac0904061246y54f76f40h6611dc982f0a7bdc AT mail DOT gmail DOT com> <20090406201123 DOT GT852 AT calimero DOT vinschen DOT de> <17393e3e0904061938n54e14997o4e28ce5ce1876e4e AT mail DOT gmail DOT com>
In-Reply-To: <17393e3e0904061938n54e14997o4e28ce5ce1876e4e@mail.gmail.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019