From: Kay Sievers Date: Thu, 10 Jul 2008 20:22:10 +0000 (+0200) Subject: scsi_id: the fallback fix broke error handling X-Git-Tag: 174~1666 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=05364975aff0bfaca1b5fb23963cee7d2201f99a scsi_id: the fallback fix broke error handling --- diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 5eb95e890..bc942fac5 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -551,7 +551,7 @@ static int set_inq_values(struct scsi_id_device *dev_scsi, const char *path) retval = scsi_std_inquiry(dev_scsi, path); if (retval) - return retval; + return retval; set_str(vendor_str, dev_scsi->vendor, sizeof(vendor_str)); set_str(model_str, dev_scsi->model, sizeof(model_str)); diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 8f160306b..016075c3e 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -351,13 +351,13 @@ resend: io_buf = (void *)&io_hdr; } - if (ioctl(fd, SG_IO, io_buf) < 0) { + retval = ioctl(fd, SG_IO, io_buf); + if (retval < 0) { if ((errno == EINVAL || errno == ENOSYS) && dev_scsi->use_sg == 4) { dev_scsi->use_sg = 3; goto resend; } info("%s: ioctl failed: %s\n", dev_scsi->kernel, strerror(errno)); - retval = -1; goto error; } @@ -806,6 +806,7 @@ int scsi_std_inquiry(struct scsi_id_device *dev_scsi, const char *devname) if (err < 0) goto out; + err = 0; memcpy(dev_scsi->vendor, buf + 8, 8); dev_scsi->vendor[8] = '\0'; memcpy(dev_scsi->model, buf + 16, 16);