This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: Patch


On May 22, 2001, neil.booth@bnpparibas.com wrote:

> +  /* There's no guarantee that errno will be unchanged, even on
> +     success.  Cygwin's lstat(), for example, will often set errno to
> +     ENOSYS.  In case of success, reset errno to zero.  */
> +  if (result == 0 && errno != 0)
> +    errno = 0;
> +

> Yes, looks like a CPP bug.  Should be good for both mainline and branch.

> Please drop the "&& errno != 0" though.

> Thanks!

I'm checking this modified version into mainline and 3.0 branch.

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* cppfiles.c (remove_component_p): Don't assume lstat/stat will
	keep errno unchanged on success.

Index: gcc/cppfiles.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cppfiles.c,v
retrieving revision 1.117
diff -u -p -r1.117 cppfiles.c
--- gcc/cppfiles.c 2001/05/05 11:12:19 1.117
+++ gcc/cppfiles.c 2001/05/22 11:51:05
@@ -1027,6 +1027,12 @@ remove_component_p (path)
   result = stat (path, &s);
 #endif
 
+  /* There's no guarantee that errno will be unchanged, even on
+     success.  Cygwin's lstat(), for example, will often set errno to
+     ENOSYS.  In case of success, reset errno to zero.  */
+  if (result == 0)
+    errno = 0;
+
   return result == 0 && S_ISDIR (s.st_mode);
 }
 

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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