change to use ftruncate(2) to truncate a file