提交 65fc17d2 编写于 作者: J John Ferlan

storage: Fix error retval for getDeviceType

On error from virAsprintf we would erroneously return 0 with
the @*type not being set. Change to a return -1 on error like
we should have been doing.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 b330600a
......@@ -4044,8 +4044,10 @@ getDeviceType(uint32_t host,
int retval = 0;
if (virAsprintf(&type_path, "/sys/bus/scsi/devices/%u:%u:%u:%u/type",
host, bus, target, lun) < 0)
host, bus, target, lun) < 0) {
retval = -1;
goto out;
}
typefile = fopen(type_path, "r");
if (typefile == NULL) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册