summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-06-12 07:20:14 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-06-12 07:20:14 +0200
commit9bbdf6eb3c0d84bf906176a51e4cda10882dadc6 (patch)
tree28e142a24df4d5f08e9faf545481a2354343185f /extras
parent2c0644c1c2089763601f9f37d0be53711735612c (diff)
cdrom_id: fix recognition of blank media
Thanks to David!
Diffstat (limited to 'extras')
-rw-r--r--extras/cdrom_id/cdrom_id.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
index 6d3326bd31..a1135665a9 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);