Fixed detach, which did not remove the filename from the filenames set

This commit is contained in:
Uwe Seimet
2021-09-01 18:20:41 +02:00
parent 4084ef07a1
commit 7b84972b4d
2 changed files with 6 additions and 3 deletions

View File

@@ -33,7 +33,7 @@
#include "interfaces/scsi_block_commands.h" #include "interfaces/scsi_block_commands.h"
#include "interfaces/scsi_primary_commands.h" #include "interfaces/scsi_primary_commands.h"
class Disk : public Device, public ScsiPrimaryCommands, public ScsiBlockCommands class Disk : public Device, ScsiPrimaryCommands, ScsiBlockCommands
{ {
private: private:
enum access_mode { RW6, RW10, RW16 }; enum access_mode { RW6, RW10, RW16 };

View File

@@ -862,12 +862,13 @@ bool ProcessCmd(int fd, const PbDeviceDefinition& pb_device, const PbOperation o
} }
} }
FileSupport *fileSupport = dynamic_cast<FileSupport *>(device);
if (operation == DETACH) { if (operation == DETACH) {
if (!dryRun) { if (!dryRun) {
device = map[id * UnitNum + unit];
map[id * UnitNum + unit] = NULL; map[id * UnitNum + unit] = NULL;
FileSupport *fileSupport = dynamic_cast<FileSupport *>(device);
if (fileSupport) { if (fileSupport) {
Filepath filepath; Filepath filepath;
fileSupport->GetPath(filepath); fileSupport->GetPath(filepath);
@@ -886,6 +887,8 @@ bool ProcessCmd(int fd, const PbDeviceDefinition& pb_device, const PbOperation o
} }
} }
FileSupport *fileSupport = dynamic_cast<FileSupport *>(device);
if ((operation == INSERT || operation == EJECT) && !device->IsRemovable()) { if ((operation == INSERT || operation == EJECT) && !device->IsRemovable()) {
return ReturnStatus(fd, false, PbOperation_Name(operation) + " operation denied (" + device->GetType() + " isn't removable)"); return ReturnStatus(fd, false, PbOperation_Name(operation) + " operation denied (" + device->GetType() + " isn't removable)");
} }