提交 ae3d31bf 编写于 作者: L Laine Stump

Remove erroneous setting of return value to errno.

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.
上级 3e0f05fc
...@@ -232,7 +232,6 @@ virStorageBackendCreateBlockFrom(virConnectPtr conn ATTRIBUTE_UNUSED, ...@@ -232,7 +232,6 @@ virStorageBackendCreateBlockFrom(virConnectPtr conn ATTRIBUTE_UNUSED,
} }
if (fstat(fd, &st) == -1) { if (fstat(fd, &st) == -1) {
ret = errno;
virReportSystemError(errno, _("stat of '%s' failed"), virReportSystemError(errno, _("stat of '%s' failed"),
vol->target.path); vol->target.path);
goto cleanup; goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册