deal with disc-image device properly.

This commit is contained in:
rocky
2004-05-07 09:55:54 +00:00
parent fa0c34a015
commit d31f2f4489

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_osx.c,v 1.21 2004/05/07 03:04:01 rocky Exp $ $Id: _cdio_osx.c,v 1.22 2004/05/07 09:55:54 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
from vcdimager code: from vcdimager code:
@@ -33,7 +33,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: _cdio_osx.c,v 1.21 2004/05/07 03:04:01 rocky Exp $"; static const char _rcsid[] = "$Id: _cdio_osx.c,v 1.22 2004/05/07 09:55:54 rocky Exp $";
#include <cdio/sector.h> #include <cdio/sector.h>
#include <cdio/util.h> #include <cdio/util.h>
@@ -863,13 +863,13 @@ cdio_open_am_osx (const char *psz_source_name, const char *psz_access_mode)
ones to set that up. ones to set that up.
*/ */
CdIo * CdIo *
cdio_open_osx (const char *orig_source_name) cdio_open_osx (const char *psz_orig_source)
{ {
#ifdef HAVE_DARWIN_CDROM #ifdef HAVE_DARWIN_CDROM
CdIo *ret; CdIo *ret;
_img_private_t *_data; _img_private_t *_data;
char *source_name; char *psz_source;
cdio_funcs _funcs = { cdio_funcs _funcs = {
.eject_media = _eject_media_osx, .eject_media = _eject_media_osx,
@@ -901,13 +901,22 @@ cdio_open_osx (const char *orig_source_name)
_data->gen.init = false; _data->gen.init = false;
_data->gen.fd = -1; _data->gen.fd = -1;
if (NULL == orig_source_name) { if (NULL == psz_orig_source) {
source_name=cdio_get_default_device_osx(); psz_source=cdio_get_default_device_osx();
if (NULL == source_name) return NULL; if (NULL == psz_source) return NULL;
_set_arg_osx(_data, "source", source_name); _set_arg_osx(_data, "source", psz_source);
free(source_name); free(psz_source);
} else } else {
_set_arg_osx(_data, "source", orig_source_name); if (cdio_is_device_generic(psz_orig_source))
_set_arg_osx(_data, "source", psz_orig_source);
else {
/* The below would be okay if all device drivers worked this way. */
#if 0
cdio_info ("source %s is a not a device", psz_orig_source);
#endif
return NULL;
}
}
ret = cdio_new (_data, &_funcs); ret = cdio_new (_data, &_funcs);
if (ret == NULL) return NULL; if (ret == NULL) return NULL;