From 7b84972b4dbba15b947c873389e62212a05382aa Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Wed, 1 Sep 2021 18:20:41 +0200 Subject: [PATCH] Fixed detach, which did not remove the filename from the filenames set --- src/raspberrypi/devices/disk.h | 2 +- src/raspberrypi/rascsi.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/raspberrypi/devices/disk.h b/src/raspberrypi/devices/disk.h index 96a31bc7..11d53b21 100644 --- a/src/raspberrypi/devices/disk.h +++ b/src/raspberrypi/devices/disk.h @@ -33,7 +33,7 @@ #include "interfaces/scsi_block_commands.h" #include "interfaces/scsi_primary_commands.h" -class Disk : public Device, public ScsiPrimaryCommands, public ScsiBlockCommands +class Disk : public Device, ScsiPrimaryCommands, ScsiBlockCommands { private: enum access_mode { RW6, RW10, RW16 }; diff --git a/src/raspberrypi/rascsi.cpp b/src/raspberrypi/rascsi.cpp index d137cc29..952616df 100644 --- a/src/raspberrypi/rascsi.cpp +++ b/src/raspberrypi/rascsi.cpp @@ -862,12 +862,13 @@ bool ProcessCmd(int fd, const PbDeviceDefinition& pb_device, const PbOperation o } } - FileSupport *fileSupport = dynamic_cast(device); - if (operation == DETACH) { if (!dryRun) { + device = map[id * UnitNum + unit]; + map[id * UnitNum + unit] = NULL; + FileSupport *fileSupport = dynamic_cast(device); if (fileSupport) { Filepath filepath; fileSupport->GetPath(filepath); @@ -886,6 +887,8 @@ bool ProcessCmd(int fd, const PbDeviceDefinition& pb_device, const PbOperation o } } + FileSupport *fileSupport = dynamic_cast(device); + if ((operation == INSERT || operation == EJECT) && !device->IsRemovable()) { return ReturnStatus(fd, false, PbOperation_Name(operation) + " operation denied (" + device->GetType() + " isn't removable)"); }