Reserved IDs should only have an effect on ATTACH (#298)

* Reserved IDs should only have an effect on ATTACH

* Updated evaluation of reserved ID string
This commit is contained in:
Uwe Seimet 2021-10-04 23:22:32 +02:00 committed by GitHub
parent 80e746b209
commit b79fd17f6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -490,7 +490,9 @@ string SetReservedIds(const string& ids)
stringstream ss(ids);
string id;
while (getline(ss, id, ',')) {
ids_to_reserve.push_back(id);
if (!id.empty()) {
ids_to_reserve.push_back(id);
}
}
set<int> reserved;
@ -1110,7 +1112,7 @@ bool ProcessCmd(int fd, const PbDeviceDefinition& pb_device, const PbCommand& co
return ReturnStatus(fd, false, error);
}
if (reserved_ids.find(id) != reserved_ids.end()) {
if (operation == ATTACH && reserved_ids.find(id) != reserved_ids.end()) {
error << "Device ID " << id << " is reserved";
return ReturnStatus(fd, false, error);
}