chiark / gitweb /
cdrom_id: Fix media state for unreadable DVDs
authorJan Drzewiecki <jonie@icpnet.pl>
Tue, 26 Oct 2010 16:10:57 +0000 (12:10 -0400)
committerMartin Pitt <martin.pitt@ubuntu.com>
Tue, 26 Oct 2010 16:10:57 +0000 (12:10 -0400)
If the disc is unreadable and reading of the first 32 blocks fails set the
cd_media status to 0 (not present). This will prevent udev from executing blkid
next that tries to determine fs on the disc and which in this case may seem to
hang forever locking the drive.

Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
extras/cdrom_id/cdrom_id.c

index ec001cde713a291f182844ec11453f08b66e24b0..f0e1cbbc42bda793250e8ee3d985e54ea1f300d4 100644 (file)
@@ -696,6 +696,7 @@ static int cd_media_info(struct udev *udev, int fd)
                scsi_cmd_set(udev, &sc, 9, 0);
                err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer));
                if ((err != 0)) {
+                       cd_media = 0;
                        info_scsi_cmd_err(udev, "READ FIRST 32 BLOCKS", err);
                        return -1;
                }