Refactor sysvmq::unlink_* and check for error

Use `sysvmq::id_from_key(key)` to receive the id of a queue identified
with `key`. Here an error check is added as well. Adapt
`Sysv::Unlink::run()` to comply with that change.
This commit is contained in:
finga 2021-07-08 14:20:53 +02:00
parent 8d127d840e
commit f4796e7da6
2 changed files with 9 additions and 4 deletions

View file

@ -25,9 +25,11 @@ impl Unlink {
info!("Removed message queue with id: {}", id);
} else if let Some(key) = self.key {
sysvmq::unlink_key(key)?;
let id = sysvmq::id_from_key(key)?;
info!("Removed message queue key: {}", key);
sysvmq::unlink_id(id)?;
info!("Removed message queue key: {} (id: {})", key, id);
}
Ok(())