desc="rmdir returns EACCES or EPERM if the directory containing the directory to be removed is marked sticky, and neither the containing directory nor the directory to be removed are owned by the effective user ID"
dir=`dirname $0`
.${dir}/../misc.sh
echo"1..47"
n0=`namegen`
n1=`namegen`
n2=`namegen`
expect0mkdir${n2}0755
cdir=`pwd`
cd${n2}
expect0mkdir${n0}0755
expect0chown${n0}6553465534
expect0chmod${n0}01777
# User owns both: the sticky directory and the directory to be removed.
expect0-u65534-g65534mkdir${n0}/${n1}0755
expectdir,65534,65534lstat${n0}/${n1}type,uid,gid
expect0-u65534-g65534rmdir${n0}/${n1}
expectENOENTlstat${n0}/${n1}type
# User owns the directory to be removed, but doesn't own the sticky directory.
foridin065533;do
expect0chown${n0}${id}${id}
create_filedir${n0}/${n1}6553465534
expectdir,65534,65534lstat${n0}/${n1}type,uid,gid
expect0-u65534-g65534rmdir${n0}/${n1}
expectENOENTlstat${n0}/${n1}type
done
# User owns the sticky directory, but doesn't own the directory to be removed.
expect0chown${n0}6553465534
foridin065533;do
create_filedir${n0}/${n1}${id}${id}
expectdir,${id},${id}lstat${n0}/${n1}type,uid,gid
expect0-u65534-g65534rmdir${n0}/${n1}
expectENOENTlstat${n0}/${n1}type
done
# User doesn't own the sticky directory nor the directory to be removed.