From d7bee1720bc0047dae2f5d031370e8095aa0737a Mon Sep 17 00:00:00 2001 From: rocky Date: Fri, 11 Feb 2005 03:30:12 +0000 Subject: [PATCH] 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. --- lib/driver/MSWindows/win32_ioctl.c | 13 ++++++++----- lib/driver/mmc.c | 17 ++++++++--------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/driver/MSWindows/win32_ioctl.c b/lib/driver/MSWindows/win32_ioctl.c index 5e3a1ee0..e18c82c0 100644 --- a/lib/driver/MSWindows/win32_ioctl.c +++ b/lib/driver/MSWindows/win32_ioctl.c @@ -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 @@ -26,7 +26,7 @@ # include "config.h" #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 @@ -223,11 +223,14 @@ run_mmc_cmd_win32ioctl( void *p_user_data, char *psz_msg = NULL; long int i_err = GetLastError(); 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); - return 1; + return DRIVER_OP_ERROR; } - return 0; + return DRIVER_OP_SUCCESS; } /*! diff --git a/lib/driver/mmc.c b/lib/driver/mmc.c index 7e912bd0..fff66c79 100644 --- a/lib/driver/mmc.c +++ b/lib/driver/mmc.c @@ -1,6 +1,6 @@ /* 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 @@ -264,15 +264,14 @@ int mmc_mode_sense( CdIo_t *p_cdio, /*out*/ void *p_buf, int i_size, int page) { - bool_3way_t e_status = cdio_have_atapi(p_cdio); - if ( yep == e_status ) { - if ( DRIVER_OP_SUCCESS == mmc_mode_sense_6(p_cdio, p_buf, i_size, page) ) - return DRIVER_OP_SUCCESS; - return mmc_mode_sense_10(p_cdio, p_buf, i_size, page); - } - if ( DRIVER_OP_SUCCESS == mmc_mode_sense_10(p_cdio, p_buf, i_size, page) ) + /* We used to make a choice as to which routine we'd use based + cdio_have_atapi(). But since that calls this in its determination, + we had an infinite recursion. So we can't use cdio_have_atapi() + (until we put in better capability checks.) + */ + if ( DRIVER_OP_SUCCESS == mmc_mode_sense_6(p_cdio, p_buf, i_size, page) ) 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)