]> granicus.if.org Git - zfs/commitdiff
All calls to ftruncate() must have their return code checked.
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 14 Aug 2009 17:11:03 +0000 (10:11 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 14 Aug 2009 17:11:03 +0000 (10:11 -0700)
Under FC11 rpm builds by default add the --fortify-source option which
ensures that functions flagged with certain attributes must have their
return codes checked.  Normally this is just a warning but we always
build with -Werror so this is fatal.  Simply wrap the function in a
verify call to ensure we catch a failure if there is one.

cmd/ztest/ztest.c

index 746db0c070a5d991aa8239d9c1f854541436c868..0e9d079a931bfecd284a06b6b129679e7befd8bb 100644 (file)
@@ -1161,7 +1161,7 @@ grow_vdev(vdev_t *vd, void *arg)
                return (vd);
 
        fsize = lseek(fd, 0, SEEK_END);
-       (void) ftruncate(fd, *newsize);
+       VERIFY(ftruncate(fd, *newsize) == 0);
 
        if (zopt_verbose >= 6) {
                (void) printf("%s grew from %lu to %lu bytes\n",