xref: /freebsd/contrib/pjdfstest/tests/chmod/02.t (revision 8657387683946d0c03e09fe77029edfe309eeb20)
1#!/bin/sh
2# vim: filetype=sh noexpandtab ts=8 sw=8
3# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/02.t 211352 2010-08-15 21:24:17Z pjd $
4
5desc="chmod returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters"
6
7dir=`dirname $0`
8. ${dir}/../misc.sh
9
10if supported lchmod; then
11	echo "1..10"
12else
13	echo "1..5"
14fi
15
16nx=`namegen_max`
17nxx="${nx}x"
18
19expect 0 create ${nx} 0644
20expect 0 chmod ${nx} 0620
21expect 0620 stat ${nx} mode
22expect 0 unlink ${nx}
23expect ENAMETOOLONG chmod ${nxx} 0620
24
25if supported lchmod; then
26	expect 0 create ${nx} 0644
27	expect 0 lchmod ${nx} 0620
28	expect 0620 stat ${nx} mode
29	expect 0 unlink ${nx}
30	expect ENAMETOOLONG lchmod ${nxx} 0620
31fi
32