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