don’t ignore return value of truncate
fix GCC 4.6 warnings