summaryrefslogtreecommitdiff
path: root/extras/ata_id/ata_id.c
diff options
context:
space:
mode:
Diffstat (limited to 'extras/ata_id/ata_id.c')
-rw-r--r--extras/ata_id/ata_id.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c
index 66b9f42332..cbd3b5b8d2 100644
--- a/extras/ata_id/ata_id.c
+++ b/extras/ata_id/ata_id.c
@@ -38,6 +38,7 @@
#include <linux/types.h>
#include <linux/hdreg.h>
#include <linux/fs.h>
+#include <linux/cdrom.h>
#include <arpa/inet.h>
#include "libudev.h"
@@ -210,6 +211,16 @@ static int disk_identify (struct udev *udev,
goto fail;
}
+ /*
+ * do not confuse optical drive firmware with ATA commands
+ * some drives are reported to blank CD-RWs
+ */
+ if (ioctl(fd, CDROM_GET_CAPABILITY, NULL) >= 0) {
+ errno = EIO;
+ ret = -1;
+ goto fail;
+ }
+
/* So, it's a block device. Let's make sure the ioctls work */
if ((ret = ioctl(fd, BLKGETSIZE64, &size)) < 0)
goto fail;