xref: /freebsd/contrib/pjdfstest/tests/chmod/03.t (revision 405c3050f102b8c74782f0366c8ead927bd07b68)
1#!/bin/sh
2# vim: filetype=sh noexpandtab ts=8 sw=8
3# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/03.t 211352 2010-08-15 21:24:17Z pjd $
4
5desc="chmod returns ENAMETOOLONG if an entire path name exceeded {PATH_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=`dirgen_max`
17nxx="${nx}x"
18
19mkdir -p "${nx%/*}"
20
21expect 0 create ${nx} 0644
22expect 0 chmod ${nx} 0642
23expect 0642 stat ${nx} mode
24expect 0 unlink ${nx}
25expect ENAMETOOLONG chmod ${nxx} 0642
26
27if supported lchmod; then
28	expect 0 create ${nx} 0644
29	expect 0 lchmod ${nx} 0642
30	expect 0642 stat ${nx} mode
31	expect 0 unlink ${nx}
32	expect ENAMETOOLONG lchmod ${nxx} 0642
33fi
34
35rm -rf "${nx%%/*}"
36