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: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
John Ferlan 2019-02-12 07:00:38 -05:00
parent b330600a69
commit 65fc17d2f6

View File

@ -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) {