summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2010-04-15 08:56:48 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2010-04-15 21:29:17 +0200
commit58e178894bfc040834e1270c6fe9b9fdef513550 (patch)
tree8e1a7b5308a2f2c04157bc89468a3a874b7954ca
parenta60b077a465b19af2efd9bf0cb5f0f67117be780 (diff)
cdrom_id: Do not ignore errors from scsi_cmd_run()
scsi_cmd_run() can return positive error messages if we have CHECK_CONDITION set and get the error code from the SCSI command result. So check the result for non-zero, not for being negative. This should fix another cause for "phantom" media in empty CD-ROM drives. Thanks to Mike Brudevold <mike@brudevold.com> for spotting this! https://launchpad.net/bugs/562978
-rw-r--r--extras/cdrom_id/cdrom_id.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
index 16b1260276..37212e9794 100644
--- a/extras/cdrom_id/cdrom_id.c
+++ b/extras/cdrom_id/cdrom_id.c
@@ -245,7 +245,7 @@ static int cd_inquiry(struct udev *udev, int fd) {
scsi_cmd_set(udev, &sc, 4, 36);
scsi_cmd_set(udev, &sc, 5, 0);
err = scsi_cmd_run(udev, &sc, fd, inq, 36);
- if ((err < 0)) {
+ if ((err != 0)) {
info_scsi_cmd_err(udev, "INQUIRY", err);
return -1;
}
@@ -351,7 +351,7 @@ static int cd_profiles(struct udev *udev, int fd)
scsi_cmd_set(udev, &sc, 8, sizeof(features) & 0xff);
scsi_cmd_set(udev, &sc, 9, 0);
err = scsi_cmd_run(udev, &sc, fd, features, sizeof(features));
- if ((err < 0)) {
+ if ((err != 0)) {
info_scsi_cmd_err(udev, "GET CONFIGURATION", err);
return -1;
}
@@ -492,7 +492,7 @@ static int cd_media_info(struct udev *udev, int fd)
scsi_cmd_set(udev, &sc, 8, sizeof(header));
scsi_cmd_set(udev, &sc, 9, 0);
err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header));
- if ((err < 0)) {
+ if ((err != 0)) {
info_scsi_cmd_err(udev, "READ DISC INFORMATION", err);
return -1;
};
@@ -526,7 +526,7 @@ static int cd_media_toc(struct udev *udev, int fd)
scsi_cmd_set(udev, &sc, 8, sizeof(header));
scsi_cmd_set(udev, &sc, 9, 0);
err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header));
- if ((err < 0)) {
+ if ((err != 0)) {
info_scsi_cmd_err(udev, "READ TOC", err);
return -1;
}
@@ -549,7 +549,7 @@ static int cd_media_toc(struct udev *udev, int fd)
scsi_cmd_set(udev, &sc, 8, len);
scsi_cmd_set(udev, &sc, 9, 0);
err = scsi_cmd_run(udev, &sc, fd, toc, len);
- if ((err < 0)) {
+ if ((err != 0)) {
info_scsi_cmd_err(udev, "READ TOC (tracks)", err);
return -1;
}
@@ -576,7 +576,7 @@ static int cd_media_toc(struct udev *udev, int fd)
scsi_cmd_set(udev, &sc, 8, 12);
scsi_cmd_set(udev, &sc, 9, 0);
err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header));
- if ((err < 0)) {
+ if ((err != 0)) {
info_scsi_cmd_err(udev, "READ TOC (multi session)", err);
return -1;
}