4 desc
="truncate descrease/increase file size"
14 expect
0 mkdir
${n1} 0755
18 expect
0 create
${n0} 0644
19 expect
0 truncate
${n0} 1234567
20 expect
1234567 lstat
${n0} size
21 expect
0 truncate
${n0} 567
22 expect
567 lstat
${n0} size
25 dd if=/dev
/random of
=${n0} bs
=12345 count
=1 >/dev
/null
2>&1
26 expect
0 truncate
${n0} 23456
27 expect
23456 lstat
${n0} size
28 expect
0 truncate
${n0} 1
29 expect
1 lstat
${n0} size
32 # successful truncate(2) updates ctime.
33 expect
0 create
${n0} 0644
34 ctime1
=`${fstest} stat ${n0} ctime`
36 expect
0 truncate
${n0} 123
37 ctime2
=`${fstest} stat ${n0} ctime`
38 test_check
$ctime1 -lt $ctime2
41 # unsuccessful truncate(2) does not update ctime.
42 expect
0 create
${n0} 0644
43 ctime1
=`${fstest} stat ${n0} ctime`
45 expect EACCES
-u 65534 truncate
${n0} 123
46 ctime2
=`${fstest} stat ${n0} ctime`
47 test_check
$ctime1 -eq $ctime2