X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Mon, 6 Apr 2009 22:11:23 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: cygwin 1.7 fstat weirdness Message-ID: <20090406201123.GT852@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <75cc17ac0904061246y54f76f40h6611dc982f0a7bdc AT mail DOT gmail DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <75cc17ac0904061246y54f76f40h6611dc982f0a7bdc@mail.gmail.com> User-Agent: Mutt/1.5.19 (2009-02-20) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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 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/