The CD device on Azure VMs returns CDS_DISC_OK from CDROM_DRIVE_STATUS even
when no disc is present. In that case an ENOMEDIUM from CDROM_LAST_WRITTEN
follows. Catch that and return error to prevent probing which results in
hundreds of "unaligned transfer" warnings in the kernel logbuffer.
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
}
# ifdef CDROM_LAST_WRITTEN
- if (ioctl(fd, CDROM_LAST_WRITTEN, &last_written) == 0)
+ if (ioctl(fd, CDROM_LAST_WRITTEN, &last_written) == 0) {
pr->flags |= BLKID_FL_CDROM_DEV;
+ } else {
+ if (errno == ENOMEDIUM)
+ goto err;
+ }
# endif
if (pr->flags & BLKID_FL_CDROM_DEV) {