From 9bbdf6eb3c0d84bf906176a51e4cda10882dadc6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 12 Jun 2008 07:20:14 +0200 Subject: [PATCH] cdrom_id: fix recognition of blank media Thanks to David! --- extras/cdrom_id/cdrom_id.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 6d3326bd..a1135665 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -470,9 +470,13 @@ static int cd_media_toc(int fd) info("READ TOC: len: %d\n", len); if (len > sizeof(toc)) return -1; - if (len < 8) + if (len < 2) return -1; + /* empty media has no tracks */ + if (len < 8) + return 0; + scsi_cmd_set(&sc, 0, 0x43); scsi_cmd_set(&sc, 6, header[2]); /* First Track/Session Number */ scsi_cmd_set(&sc, 7, len >> 8); -- 2.39.5