Add "c" at end of drive specification if not FreeBSD 5.x.

Handle not getting default drive more gracefully.

As always changes based on suggestions from Heiner.
This commit is contained in:
rocky
2004-06-19 11:07:55 +00:00
parent e002a930bc
commit 03e7cde7fd
2 changed files with 14 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: freebsd.c,v 1.20 2004/06/12 18:45:54 rocky Exp $
$Id: freebsd.c,v 1.21 2004/06/19 11:07:55 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: freebsd.c,v 1.20 2004/06/12 18:45:54 rocky Exp $";
static const char _rcsid[] = "$Id: freebsd.c,v 1.21 2004/06/19 11:07:55 rocky Exp $";
#include "freebsd.h"
@@ -443,7 +443,7 @@ cdio_get_devices_freebsd (void)
Not always 100% reliable, so use the USE_MNTENT code above first.
*/
for ( c='0'; exists && c <='9'; c++ ) {
sprintf(drive, "/dev/cd%cc", c);
sprintf(drive, "/dev/cd%c%s", c, DEVICE_POSTFIX);
exists = cdio_is_cdrom(drive, NULL);
if ( exists ) {
cdio_add_device_list(&drives, drive, &num_drives);
@@ -495,7 +495,7 @@ cdio_get_default_device_freebsd()
Not always 100% reliable, so use the USE_MNTENT code above first.
*/
for ( c='0'; exists && c <='9'; c++ ) {
sprintf(drive, "/dev/cd%cc", c);
sprintf(drive, "/dev/cd%c%s", c, DEVICE_POSTFIX);
exists = cdio_is_cdrom(drive, NULL);
if ( exists ) {
return strdup(drive);
@@ -569,6 +569,7 @@ cdio_open_am_freebsd (const char *psz_orig_source_name,
if (NULL == psz_orig_source_name) {
psz_source_name=cdio_get_default_device_freebsd();
if (NULL == psz_source_name) return NULL;
_data->device = psz_source_name;
_set_arg_freebsd(_data, "source", psz_source_name);
} else {

View File

@@ -1,5 +1,5 @@
/*
$Id: freebsd.h,v 1.10 2004/06/12 17:40:08 rocky Exp $
$Id: freebsd.h,v 1.11 2004/06/19 11:07:56 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -37,7 +37,7 @@
DEFAULT_FREEBSD_AM should be consistent.
*/
#ifndef DEFUALT_CDIO_DEVICE
#ifndef DEFAULT_CDIO_DEVICE
#define DEFAULT_CDIO_DEVICE "/dev/cd0c"
#endif
@@ -76,7 +76,13 @@ struct ioc_read_audio
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/param.h> /* for __FreeBSD_version */
#if __FreeBSD_version < 500000
#define DEVICE_POSTFIX "c"
#else
#define DEVICE_POSTFIX ""
#endif
#define HAVE_FREEBSD_CAM
#ifdef HAVE_FREEBSD_CAM