]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Remove erroneous setting of return value to errno.
authorLaine Stump <laine@laine.org>
Mon, 19 Jul 2010 23:52:57 +0000 (19:52 -0400)
committerLaine Stump <laine@laine.org>
Wed, 21 Jul 2010 21:32:19 +0000 (17:32 -0400)
One error exit in virStorageBackendCreateBlockFrom was setting the
return value to errno. The convention for volume build functions is to
return 0 on success or -1 on failure. Not only was it not necessary to
set the return value (it defaults to -1, and is set to 0 when
everything has been successfully completed), in the case that some
caller were checking for < 0 rather than != 0, they would incorrectly
believe that it completed successfully.

src/storage/storage_backend.c

index 5b61bba3bae9c2f4d4aa6fd1123b9b6862ae801a..d9897434d56b0e367b69eedcd3553272a7d8e2e4 100644 (file)
@@ -232,7 +232,6 @@ virStorageBackendCreateBlockFrom(virConnectPtr conn ATTRIBUTE_UNUSED,
     }
 
     if (fstat(fd, &st) == -1) {
-        ret = errno;
         virReportSystemError(errno, _("stat of '%s' failed"),
                              vol->target.path);
         goto cleanup;