summaryrefslogtreecommitdiff
path: root/gcc/gcov.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-14 21:44:01 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-14 21:44:01 +0000
commit6636439ef7b674bb9ddde82514f08253eb70572d (patch)
tree559a3ee3d7f99cfb27e1f5fd5cade3a06abf47c7 /gcc/gcov.c
parentd6da0cf537a9b8e3e836f3ddb602b327418a9f5a (diff)
downloadgcc-6636439ef7b674bb9ddde82514f08253eb70572d.tar.gz
* gcov.c (canonicalize_name): Protect use of S_ISLNK.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181367 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcov.c')
-rw-r--r--gcc/gcov.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/gcov.c b/gcc/gcov.c
index dffb827bdf7..c5cc0efdf1a 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -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;