#!/bin/sh

. ./test-functions

echo -n "/proc clear as user test:		"
( # Sub-shell so as not to taint the test process.
	read -r subshellpid _ < /proc/self/stat
	echo 1 > /proc/$subshellpid/attr/current
	su -c "echo 0 > /proc/$subshellpid/attr/current" $SUDO_USER 2> /dev/null
	if [ $? == 0 ]; then
		failmsg able to clear taint through /proc
		exit
	fi

	val=$(cat /proc/$subshellpid/attr/current)
	if [ x$val == x0 ]; then
		failmsg able to clear taint through /proc; set to $val
	else
		passmsg unable to clear taint through /proc
	fi
)
