mmc.c: mmc_mode_sense can't use cdio_have_atapi (without further check) or else

we may get an infinite recursion.
win32_ioctl.c: deal with an error message that can't be converted to a string.
This commit is contained in:
rocky
2005-02-11 03:30:12 +00:00
parent 43f59fc830
commit d7bee1720b
2 changed files with 16 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: win32_ioctl.c,v 1.14 2005/02/07 04:16:19 rocky Exp $ $Id: win32_ioctl.c,v 1.15 2005/02/11 03:30:12 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.14 2005/02/07 04:16:19 rocky Exp $"; static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.15 2005/02/11 03:30:12 rocky Exp $";
#ifdef HAVE_WIN32_CDROM #ifdef HAVE_WIN32_CDROM
@@ -223,11 +223,14 @@ run_mmc_cmd_win32ioctl( void *p_user_data,
char *psz_msg = NULL; char *psz_msg = NULL;
long int i_err = GetLastError(); long int i_err = GetLastError();
FORMAT_ERROR(i_err, psz_msg); FORMAT_ERROR(i_err, psz_msg);
cdio_info("Error: %s", psz_msg); if (psz_msg)
cdio_info("Error: %s", psz_msg);
else
cdio_info("Error: %ld", i_err);
LocalFree(psz_msg); LocalFree(psz_msg);
return 1; return DRIVER_OP_ERROR;
} }
return 0; return DRIVER_OP_SUCCESS;
} }
/*! /*!

View File

@@ -1,6 +1,6 @@
/* Common Multimedia Command (MMC) routines. /* Common Multimedia Command (MMC) routines.
$Id: mmc.c,v 1.10 2005/02/11 01:34:12 rocky Exp $ $Id: mmc.c,v 1.11 2005/02/11 03:30:12 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -264,15 +264,14 @@ int
mmc_mode_sense( CdIo_t *p_cdio, /*out*/ void *p_buf, int i_size, mmc_mode_sense( CdIo_t *p_cdio, /*out*/ void *p_buf, int i_size,
int page) int page)
{ {
bool_3way_t e_status = cdio_have_atapi(p_cdio); /* We used to make a choice as to which routine we'd use based
if ( yep == e_status ) { cdio_have_atapi(). But since that calls this in its determination,
if ( DRIVER_OP_SUCCESS == mmc_mode_sense_6(p_cdio, p_buf, i_size, page) ) we had an infinite recursion. So we can't use cdio_have_atapi()
return DRIVER_OP_SUCCESS; (until we put in better capability checks.)
return mmc_mode_sense_10(p_cdio, p_buf, i_size, page); */
} if ( DRIVER_OP_SUCCESS == mmc_mode_sense_6(p_cdio, p_buf, i_size, page) )
if ( DRIVER_OP_SUCCESS == mmc_mode_sense_10(p_cdio, p_buf, i_size, page) )
return DRIVER_OP_SUCCESS; return DRIVER_OP_SUCCESS;
return mmc_mode_sense_6(p_cdio, p_buf, i_size, page); return mmc_mode_sense_10(p_cdio, p_buf, i_size, page);
} }
/*! Run a MODE_SENSE command (6-byte version) /*! Run a MODE_SENSE command (6-byte version)