diff --git a/src/raspberrypi/controllers/sasidev_ctrl.cpp b/src/raspberrypi/controllers/sasidev_ctrl.cpp index 203dedf0..02d55025 100644 --- a/src/raspberrypi/controllers/sasidev_ctrl.cpp +++ b/src/raspberrypi/controllers/sasidev_ctrl.cpp @@ -986,7 +986,16 @@ void FASTCALL SASIDEV::CmdRequestSense() LOGTRACE( "%s REQUEST SENSE Command ", __PRETTY_FUNCTION__); - DWORD lun = GetLun(); + DWORD lun; + try { + lun = GetLun(); + } + catch(const lunexception& e) { + LOGINFO("%s unsupported LUN %d", __PRETTY_FUNCTION__, (int)e.getlun()); + // LOGICAL UNIT NOT SUPPORTED + Error(0x05, 0x25); + return; + } ctrl.length = ctrl.unit[lun]->RequestSense(ctrl.cmd, ctrl.buffer); ASSERT(ctrl.length > 0); @@ -1641,7 +1650,7 @@ void FASTCALL SASIDEV::ReceiveNext() try { Execute(); } - catch (lunexception& e) { + catch (const lunexception& e) { LOGINFO("%s unsupported LUN %d", __PRETTY_FUNCTION__, (int)e.getlun()); // LOGICAL UNIT NOT SUPPORTED Error(0x05, 0x25); diff --git a/src/raspberrypi/controllers/scsidev_ctrl.cpp b/src/raspberrypi/controllers/scsidev_ctrl.cpp index d0088435..f4c8b3f0 100644 --- a/src/raspberrypi/controllers/scsidev_ctrl.cpp +++ b/src/raspberrypi/controllers/scsidev_ctrl.cpp @@ -1630,7 +1630,7 @@ void FASTCALL SCSIDEV::Receive() try { Execute(); } - catch (lunexception& e) { + catch (const lunexception& e) { LOGINFO("%s unsupported LUN %d", __PRETTY_FUNCTION__, (int)e.getlun()); // LOGICAL UNIT NOT SUPPORTED Error(0x05, 0x25); diff --git a/src/raspberrypi/exceptions.h b/src/raspberrypi/exceptions.h index d6d4e874..7d2c6d28 100644 --- a/src/raspberrypi/exceptions.h +++ b/src/raspberrypi/exceptions.h @@ -23,7 +23,7 @@ public: ~lunexception() { } - DWORD getlun() { + DWORD getlun() const { return lun; } };