Reject inserting a medium when there is already a medium present (eject first)

This commit is contained in:
Uwe Seimet 2021-08-29 14:13:34 +02:00
parent d0eb629343
commit 5308a6e74d

View File

@ -880,6 +880,10 @@ bool ProcessCmd(int fd, const PbDeviceDefinition& pbDevice, const PbOperation op
switch (operation) {
case INSERT: {
if (!device->IsRemoved()) {
return ReturnStatus(fd, false, "Existing medium must first be ejected");
}
if (!pbDevice.vendor().empty() || !pbDevice.product().empty() || !pbDevice.revision().empty()) {
return ReturnStatus(fd, false, "Device name cannot be changed");
}