ftruncate takes an off_t, not a size_t.
reference: http://pubs.opengroup.org/onlinepubs/009604499/functions/ftruncate.html
Added reference to spec in comment.
this looks fine to me; but I'd like @EricWF to chime in here.