xref: /freebsd/contrib/pjdfstest/tests/mknod/06.t (revision 0e97acdf58fe27b09c4824a474b0344daf997c5f)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/06.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="mknod returns EACCES when write permission is denied on the parent directory of the file to be created"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9echo "1..12"
10
11n0=`namegen`
12n1=`namegen`
13n2=`namegen`
14
15expect 0 mkdir ${n0} 0755
16cdir=`pwd`
17cd ${n0}
18expect 0 mkdir ${n1} 0755
19expect 0 chown ${n1} 65534 65534
20expect 0 -u 65534 -g 65534 mknod ${n1}/${n2} f 0644 0 0
21expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
22expect 0 chmod ${n1} 0555
23expect EACCES -u 65534 -g 65534 mknod ${n1}/${n2} f 0644 0 0
24expect 0 chmod ${n1} 0755
25expect 0 -u 65534 -g 65534 mknod ${n1}/${n2} f 0644 0 0
26expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
27expect 0 rmdir ${n1}
28cd ${cdir}
29expect 0 rmdir ${n0}
30