]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: check status for the current CDROM slot
authorKarel Zak <kzak@redhat.com>
Wed, 8 Jan 2020 08:23:04 +0000 (09:23 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 8 Jan 2020 08:23:04 +0000 (09:23 +0100)
It's probably more safer.

Reported-by: Michal Suchánek <msuchanek@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/probe.c

index 871cd9bf21aafa8a53594ac207e8aea39c131793..a8c2d3b4da309a341c886fe03f4a9a914db1977b 100644 (file)
@@ -946,7 +946,7 @@ int blkid_probe_set_device(blkid_probe pr, int fd,
            ioctl(fd, CDROM_GET_CAPABILITY, NULL) >= 0) {
 
 # ifdef CDROM_DRIVE_STATUS
-               switch (ioctl(fd, CDROM_DRIVE_STATUS, 0)) {
+               switch (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT)) {
                case CDS_TRAY_OPEN:
                case CDS_NO_DISC:
                        errno = ENOMEDIUM;