Check the return value of ftruncate(), mostly to stop Ubuntu 12.04's
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 3 May 2012 17:46:25 +0000 (17:46 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 3 May 2012 17:46:25 +0000 (17:46 +0000)
gcc complaining.

git-svn-id: svn://svn.tartarus.org/sgt/agedu@9479 cda61777-01e9-0310-a592-d414129be87e

agedu.c

diff --git a/agedu.c b/agedu.c
index 7fd2314..411ae6a 100644 (file)
--- 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);