chiark / gitweb /
cdrom_id: Swap media state and TOC info probing
authorMartin Pitt <martin.pitt@ubuntu.com>
Thu, 15 Apr 2010 19:25:57 +0000 (21:25 +0200)
committerMartin Pitt <martin.pitt@ubuntu.com>
Thu, 15 Apr 2010 19:29:18 +0000 (21:29 +0200)
Blank CDs do not have a TOC, thus will fail cd_media_toc() (at least with the
"Do not ignore errors from scsi_cmd_run()" fix). Thus probe the media state
first, so that we can properly detect blank media.

extras/cdrom_id/cdrom_id.c

index 37212e9794f79424fa59f4012d76ec983c58260d..722b8f8f45fc52fe5ae8a4d171d5ec67ede1907d 100644 (file)
@@ -681,14 +681,14 @@ int main(int argc, char *argv[])
        if (cd_profiles(udev, fd) < 0)
                goto print;
 
-       /* get session/track info */
-       if (cd_media_toc(udev, fd) < 0)
-               goto print;
-
        /* get writable media state */
        if (cd_media_info(udev, fd) < 0)
                goto print;
 
+       /* get session/track info */
+       if (cd_media_toc(udev, fd) < 0)
+               goto print;
+
 print:
        printf("ID_CDROM=1\n");
        if (cd_cd_rom)