diff options
author | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-22 11:57:21 +0000 |
---|---|---|
committer | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-22 11:57:21 +0000 |
commit | 6679820645c6e7ab2c2b33b444dea509e10b4320 (patch) | |
tree | 50f7a8ee2baf653766e6fa57d4be346da0b8a196 /gcc | |
parent | 26d7a7b1ff4a9a06368e4373cd4cc72b4b23f724 (diff) | |
download | gcc-6679820645c6e7ab2c2b33b444dea509e10b4320.tar.gz |
* cppfiles.c (remove_component_p): Don't assume lstat/stat will
keep errno unchanged on success.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42445 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cppfiles.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b9eeac7cf93..9d713505206 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-05-22 Alexandre Oliva <aoliva@redhat.com> + + * cppfiles.c (remove_component_p): Don't assume lstat/stat will + keep errno unchanged on success. + 2001-05-22 Joseph S. Myers <jsm28@cam.ac.uk> * c-lex.c (lex_number): If pedantic and not C99, pedwarn exactly diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index dea6dd6677e..137882b340c 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -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); } |