diff --git a/lib/driver/device.c b/lib/driver/device.c index b05acd9a..c35743a5 100644 --- a/lib/driver/device.c +++ b/lib/driver/device.c @@ -1,5 +1,5 @@ /* - $Id: device.c,v 1.31 2006/01/15 01:26:50 rocky Exp $ + $Id: device.c,v 1.32 2006/02/01 00:45:45 rocky Exp $ Copyright (C) 2005, 2006 Rocky Bernstein @@ -843,6 +843,20 @@ cdio_have_driver(driver_id_t driver_id) bool cdio_is_device(const char *psz_source, driver_id_t driver_id) { + if (DRIVER_UNKNOWN == driver_id || DRIVER_DEVICE == driver_id) { + if (DRIVER_UNKNOWN == driver_id) + driver_id++; + else + driver_id = CDIO_MIN_DEVICE_DRIVER; + + /* Scan for driver */ + for ( ; driver_id<=CDIO_MAX_DRIVER; driver_id++) { + if ( (*CdIo_all_drivers[driver_id].have_driver)() && + CdIo_all_drivers[driver_id].is_device ) { + return (*CdIo_all_drivers[driver_id].is_device)(psz_source); + } + } + } if (CdIo_all_drivers[driver_id].is_device == NULL) return false; return (*CdIo_all_drivers[driver_id].is_device)(psz_source); } diff --git a/test/testparanoia.c b/test/testparanoia.c index 9d01e9ec..ae6f5e0b 100644 --- a/test/testparanoia.c +++ b/test/testparanoia.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005 Rocky Bernstein + * Copyright (C) 2005, 2006 Rocky Bernstein * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,6 +75,12 @@ main(int argc, const char *argv[]) exit(SKIP_TEST_RC); } + /** We had a bug in is_device when driver_id == DRIVER_UNKNOWN or + DRIVER_DEVICE. Let's make sure we've fixed that problem. **/ + if (!cdio_is_device(*ppsz_cd_drives, DRIVER_UNKNOWN) || + !cdio_is_device(*ppsz_cd_drives, DRIVER_DEVICE)) + exit(99); + /* Don't need a list of CD's with CD-DA's any more. */ cdio_free_device_list(ppsz_cd_drives);