[Bug c++/11242] #include <memory> takes my memory directory instead of the standard memory header file

dannysmith at users dot sourceforge dot net gcc-bugzilla@gcc.gnu.org
Thu May 20 20:23:00 GMT 2004


------- Additional Comments From dannysmith at users dot sourceforge dot net  2004-05-19 21:27 -------
Hi, 
This bug is still present on mingw32 hosts on both 3.4.0 and trunk.

It is caused by the behaviour of open() in cppfiles:open_file().  On mingw32 
_any_ attempt to open() a directory fails and sets errno to EACCES, regardless 
of permissions.  So, rather than continuing the search for a valid header, the 
search fails with "Permission denied"

This will fix:

Index: cppfiles.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppfiles.c,v
retrieving revision 1.209
diff -c -3 -p -r1.209 cppfiles.c
*** cppfiles.c	5 May 2004 18:25:52 -0000	1.209
--- cppfiles.c	19 May 2004 21:18:52 -0000
*************** open_file (_cpp_file *file)
*** 233,238 ****
--- 233,246 ----
    else if (errno == ENOTDIR)
      errno = ENOENT;
  
+    /* An attempt to open() a directory may fail and set errno to EACCES.
+       On __MINGW32__ host an attempt to open() _any_ directory will do this.
+       Check and reset errno to ENOENT.  */
+   else if (errno == EACCES
+ 	   && stat (file->path, &file->st) == 0
+ 	   && S_ISDIR (file->st.st_mode))
+     errno = ENOENT;
+ 
    file->err_no = errno;
  
    return false;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11242



More information about the Gcc-bugs mailing list