Index: coregrind//valgrind.in =================================================================== RCS file: /cvsroot/valgrind/valgrind/coregrind/valgrind.in,v retrieving revision 1.33 diff -p -u -r1.33 valgrind.in --- coregrind//valgrind.in 17 Oct 2003 09:36:09 -0000 1.33 +++ coregrind//valgrind.in 21 Oct 2003 09:33:09 -0000 @@ -104,35 +104,33 @@ export VG_ARGS # tell the dynamic loader to disable this interface using # an environment variable. -if getconf GNU_LIBPTHREAD_VERSION | grep -qi NPTL 2>/dev/null; then +if getconf GNU_LIBPTHREAD_VERSION 2>/dev/null | grep -qi NPTL; then LD_ASSUME_KERNEL=2.4.1 export LD_ASSUME_KERNEL fi which_prog="`which $1`" -# Ensure the program isn't statically linked. +# Ensure the program isn't statically linked, and that it's not setuid +# or setgid. if [ $# != 0 ] ; then - case `file "$which_prog"` in + case `file -L "$which_prog"` in *"statically linked"*) echo "\`$which_prog' is statically linked" echo "Valgrind only works on dynamically linked executables; your" echo "program must rely on at least one shared object for Valgrind" echo "to work with it. Read FAQ #5 for more information." exit 1 ;; + *set[ug]id*) + echo "\`$which_prog' is suid/sgid." + echo "Valgrind can't handle these executables, as it" + echo "requires the LD_PRELOAD feature in order to work." + echo "" + echo "Remove those flags and try again." + exit 1 ;; esac fi -# Ensure that there is no suid or sgid flag -if [ `stat -c %a "$which_prog"` -gt 2000 ] ; then - echo "\`$which_prog' is suid/sgid." - echo "Valgrind can't handle these executables, as it" - echo "requires the LD_PRELOAD feature in order to work." - echo "" - echo "Remove those flags and try again." - exit 1 -fi - # A bit subtle. The LD_PRELOAD added entry must be absolute # and not depend on LD_LIBRARY_PATH. This is so that we can # mess with LD_LIBRARY_PATH for child processes, which makes