diff options
author | Nathan Sidwell <nathan@acm.org> | 2011-11-14 21:44:01 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2011-11-14 21:44:01 +0000 |
commit | 8c121ccb537f02ade6f9fdb67f13f24b3c94c48d (patch) | |
tree | 559a3ee3d7f99cfb27e1f5fd5cade3a06abf47c7 /gcc | |
parent | 2f5623b20c1e333cb58f928dfcde0079dfb264b3 (diff) | |
download | gcc-8c121ccb537f02ade6f9fdb67f13f24b3c94c48d.zip gcc-8c121ccb537f02ade6f9fdb67f13f24b3c94c48d.tar.gz gcc-8c121ccb537f02ade6f9fdb67f13f24b3c94c48d.tar.bz2 |
* gcov.c (canonicalize_name): Protect use of S_ISLNK.
From-SVN: r181367
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/gcov.c | 11 |
2 files changed, 12 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e7c6952..94661b5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2011-11-14 Nathan Sidwell <nathan@acm.org> + + * gcov.c (canonicalize_name): Protect use of S_ISLNK. + 2011-11-14 Jan Hubicka <jh@suse.cz> * config/i386/i386.c (core cost model): Correct pasto. @@ -1688,10 +1688,15 @@ canonicalize_name (const char *name) { /* '..', we can only elide it and the previous directory, if we're not a symlink. */ - struct stat buf; - + struct stat ATTRIBUTE_UNUSED buf; + *ptr = 0; - if (dd_base == ptr || stat (result, &buf) || S_ISLNK (buf.st_mode)) + if (dd_base == ptr +#if defined (S_ISLNK) + /* S_ISLNK is not POSIX.1-1996. */ + || stat (result, &buf) || S_ISLNK (buf.st_mode) +#endif + ) { /* Cannot elide, or unreadable or a symlink. */ dd_base = ptr + 2 + slash; |