stat() returning EFAULT?

Sjors Gielen mailinglist@dazjorz.com
Tue Feb 24 15:54:00 GMT 2009


Hey all,

I noticed this weird cygwinism and wrote a little test case. It seems 
stat() is returning EFAULT on some of my files. I've done some digging 
through Cygwin source but couldn't see the source of the problem.

The testcase is a simple test.c which is compiled to test.exe. After 
that, it does a stat("test") and a stat("test.exe"). It doesn't matter 
if it runs stat on itself or on a different binary, so I chose to keep 
things simple.

Here's the test case and output:

#include <errno.h>
int main() {
	if(stat("test") != 0) perror("Calling stat() on test");
	if(stat("test.exe") != 0) perror("Calling stat() on test.exe");
	return 0;
}
// Calling stat() on test: Bad address
// Calling stat() on test.exe: Bad address

As far as I could see, the strace wasn't very informative. I've attached 
the relevant parts.

This is Cygwin from the current bleeding-edge CVS. Could anybody explain 
why stat() is returning -1 with errno set to EFAULT?

Sjors
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: statefault_strace.txt
URL: <http://cygwin.com/pipermail/cygwin/attachments/20090224/61ee8cee/attachment.txt>
-------------- next part --------------
--
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/


More information about the Cygwin mailing list