builtin-mailinfo.c: check error status from rewind and ftruncate