delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/04/07/12:34:29

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_44,J_CHICKENPOX_71,SARE_MSGID_LONG40
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <17393e3e0904061938n54e14997o4e28ce5ce1876e4e@mail.gmail.com>
References: <75cc17ac0904061246y54f76f40h6611dc982f0a7bdc AT mail DOT gmail DOT com> <20090406201123 DOT GT852 AT calimero DOT vinschen DOT de> <17393e3e0904061938n54e14997o4e28ce5ce1876e4e AT mail DOT gmail DOT com>
Date: Tue, 7 Apr 2009 11:34:07 -0500
Message-ID: <75cc17ac0904070934sb498769h38b569799ef5b430@mail.gmail.com>
Subject: Re: cygwin 1.7 fstat weirdness
From: Gregg Reynolds <dev AT mobileink DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Mon, Apr 6, 2009 at 9:38 PM, Matt Wozniski <godlygeek AT gmail DOT com> wrote:
>
> On Mon, Apr 6, 2009 at 4:11 PM, Corinna Vinschen wrote:
> > On Apr =C2=A06 14:46, Gregg Reynolds wrote:
> >> =C2=A0 int fd =3D path ? open(path, O_RDONLY, TCFILEMODE) : 0; =C2=A0/=
/ path =3D "Makefile"
> >
> > Is fd =3D=3D 0 by any chance? =C2=A0The 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...

Right, the code does something if fd =3D=3D 0, but I'm actually trying to
avoid learning the internals. =C2=A0Alas this has already chewed up a lot
of time and I haven't made any headway trying to reproduce it so I'm
about ready to throw in the towel.=C2=A0 The code path looks very simple:
read the command line and call a function to open a file.=C2=A0 The thing
is, the file opens just fine, and I can even read from it, but fstat
(or the S_ISX macros) puke.=C2=A0 I tried stripping out all non-essentials
in the Makefile (e.g. it defines __EXTENSIONS__, _GNU_SOURCE, etc. and
 does some odd stuff with paths) to no avail.=C2=A0 In case anybody wants
to give it a try on another machine, the function is tcreadfile in
tcutil.h in =C2=A0http://sourceforge.net/projects/tokyocabinet/ - remember
you have to add

#define strtold(a,b) ((long double)strtod((a),(b)))

to tcutil.c so tcatoix will compile.=C2=A0 Other than that I think it will
compile on 1.7.

Thanks,

gregg

--
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