This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygwin 1.7 fstat weirdness


On Apr  6 14:46, Gregg Reynolds wrote:
> Hi,
> 
> I'm trying to get tokyo cabinet running.  I have a strange error.  One
> of the test utilities does:
> 
>   #define TCFILEMODE     00644             // permission of a creating file
>   int fd = path ? open(path, O_RDONLY, TCFILEMODE) : 0;  // path = "Makefile"
> 
> and then fstats:
> 
>   if(fstat(fd, &sbuf) == -1) {...}
>   else {
>     if (!S_ISREG(sbuf.st_mode)){
>            printf("is dir %d\n", S_ISDIR(sbuf.st_mode));  // added for debugging
>            ...etc...
>   }}
> 
> What's weird is that fstat says ./Makefile is of type S_ISCHR .  I

Is fd == 0 by any chance?  The above code silently sets fd to 0 if it
can't open path.  You should debug your code.  Other than that, I'd
really need a reproducible testcase.  I don't see any chance that an
open file on disk is recognized as S_ISCHR.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]