From: simon Date: Thu, 3 May 2012 17:46:25 +0000 (+0000) Subject: Check the return value of ftruncate(), mostly to stop Ubuntu 12.04's X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/agedu/commitdiff_plain/4cc1cf917ec78bc543924602c472a56cbf77ba70 Check the return value of ftruncate(), mostly to stop Ubuntu 12.04's gcc complaining. git-svn-id: svn://svn.tartarus.org/sgt/agedu@9479 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/agedu.c b/agedu.c index 7fd2314..411ae6a 100644 --- a/agedu.c +++ b/agedu.c @@ -1246,7 +1246,8 @@ int main(int argc, char **argv) indexbuild_free(ib); munmap(mappedfile, totalsize); - ftruncate(fd, realsize); + if (ftruncate(fd, realsize) < 0) + fatal("%s: truncate: %s\n", filename, strerror(errno)); close(fd); printf("Final index file size = %llu bytes\n", (unsigned long long)realsize);