Fix bug in is_device when driver_id = DRIVER_UNKNOWN or DRIVER_DEVICE
This commit is contained in:
@@ -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 <rocky@panix.com>
|
Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -843,6 +843,20 @@ cdio_have_driver(driver_id_t driver_id)
|
|||||||
bool
|
bool
|
||||||
cdio_is_device(const char *psz_source, driver_id_t driver_id)
|
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;
|
if (CdIo_all_drivers[driver_id].is_device == NULL) return false;
|
||||||
return (*CdIo_all_drivers[driver_id].is_device)(psz_source);
|
return (*CdIo_all_drivers[driver_id].is_device)(psz_source);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
* Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* 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);
|
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. */
|
/* Don't need a list of CD's with CD-DA's any more. */
|
||||||
cdio_free_device_list(ppsz_cd_drives);
|
cdio_free_device_list(ppsz_cd_drives);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user