2 # vim: filetype=sh noexpandtab ts=8 sw=8
5 desc="utimensat with UTIME_NOW will work if the caller has write permission"
16 UID_NOBODY=`id -u nobody`
17 GID_NOBODY=`id -g nobody`
21 expect 0 mkdir ${n1} 0755
25 create_file regular ${n0} 0644
26 # First check that nobody can't update the timestamps
27 expect EACCES -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_NOW 0 UTIME_NOW 0
29 # Now check that the owner can update the timestamps
30 expect 0 chown ${n0} $UID_NOBODY $GID_NOBODY
31 expect 0 chmod ${n0} 0444
32 expect 0 -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_NOW 0 UTIME_NOW 0
34 # Now check that the superuser can update the timestamps
35 expect 0 -u $UID_ROOT open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_OMIT 0 UTIME_OMIT 0
37 # Now check that anyone with write permission can update the timestamps
38 expect 0 chown ${n0} $UID_ROOT $GID_ROOT
39 expect 0 chmod ${n0} 0666
40 expect 0 -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_NOW 0 UTIME_NOW 0