[PATCH] libblkid/src/probe: check for ENOMEDIUM from ioctl(CDROM_LAST_WRITTEN)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
---
 libblkid/src/probe.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
index 3685ea5e1..513649916 100644
--- a/libblkid/src/probe.c
+++ b/libblkid/src/probe.c
@@ -994,8 +994,12 @@ int blkid_probe_set_device(blkid_probe pr, int fd,
 		}
 
 # 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) {
-- 
2.32.0




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux