From 4cc1cf917ec78bc543924602c472a56cbf77ba70 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 3 May 2012 17:46:25 +0000 Subject: [PATCH] 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 --- agedu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.11.0