Bug #343967 Don't warn about setuid/setgid/setcap exec for dirs.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14922 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/NEWS b/NEWS
index 23f3140..8fd2660 100644
--- a/NEWS
+++ b/NEWS
@@ -91,6 +91,7 @@
 343733  Unhandled syscall 187 (msgctl and related) on aarch64
 343802  s390x: Fix false positives "conditional jump or move depends on
         unitialised value(s)"
+343967  Don't warn about setuid/setgid/setcap executable for directories
 n-i-bz  Provide implementations of certain compiler builtins to support
         compilers who may not provide those
 n-i-bz  Old STABS code is still being compiled, but never used. Remove it.
diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c
index 210d49b..55d33f7 100644
--- a/coregrind/m_libcfile.c
+++ b/coregrind/m_libcfile.c
@@ -628,6 +628,10 @@
       return sr_Err(res);
    }
 
+   if ( VKI_S_ISDIR (st.mode) ) {
+      return VKI_EACCES;
+   }
+
    if ( (st.mode & (VKI_S_ISUID | VKI_S_ISGID)) && !allow_setuid ) {
       if (is_setuid)
          *is_setuid = True;