diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2001-05-22 11:57:21 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2001-05-22 11:57:21 +0000 |
commit | 8d75ad04d0f89e21f9c68682067442ae21f9a980 (patch) | |
tree | 50f7a8ee2baf653766e6fa57d4be346da0b8a196 /gcc/cppfiles.c | |
parent | 75f153f3d418e66aaccf5f75800afcfcf39b7b4f (diff) | |
download | gcc-8d75ad04d0f89e21f9c68682067442ae21f9a980.zip gcc-8d75ad04d0f89e21f9c68682067442ae21f9a980.tar.gz gcc-8d75ad04d0f89e21f9c68682067442ae21f9a980.tar.bz2 |
cppfiles.c (remove_component_p): Don't assume lstat/stat will keep errno unchanged on success.
* cppfiles.c (remove_component_p): Don't assume lstat/stat will
keep errno unchanged on success.
From-SVN: r42445
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r-- | gcc/cppfiles.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index dea6dd6..137882b 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); } |