summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarol Wachowski <karol.wachowski@intel.com>2020-08-05 15:09:01 +0300
committerWachowski, Karol <karol.wachowski@intel.com>2020-08-06 09:37:07 +0300
commit82935680e9bf7e26fa6363461e5416ff31659902 (patch)
treebfe81ad54e57b70b84e50f54322b8740352f1a76
parent453a2fb573de983245b2a55d68945742e81534e3 (diff)
downloadvirtual-media-82935680e9bf7e26fa6363461e5416ff31659902.tar.xz
Fix false positive mount result when in active state
Tested: - verified that mount attempt in active state returns operation not supported (EOPNOTSUPP) error Signed-off-by: Karol Wachowski <karol.wachowski@intel.com> Change-Id: I3d148a6f360e4ede996f99827185ae653e0ed5c5
-rw-r--r--src/state/active_state.hpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/state/active_state.hpp b/src/state/active_state.hpp
index 541e27e..766c105 100644
--- a/src/state/active_state.hpp
+++ b/src/state/active_state.hpp
@@ -45,7 +45,7 @@ struct ActiveState : public BasicStateT<ActiveState>
// unmount media & stop retriggering timer
boost::asio::spawn(
machine.getIoc(),
- [& machine = machine](boost::asio::yield_context yield) {
+ [&machine = machine](boost::asio::yield_context yield) {
machine.emitUnmountEvent();
});
return;
@@ -84,10 +84,11 @@ struct ActiveState : public BasicStateT<ActiveState>
}
template <class AnyEvent>
- std::unique_ptr<BasicState> handleEvent(AnyEvent event)
+ [[noreturn]] std::unique_ptr<BasicState> handleEvent(AnyEvent event)
{
LogMsg(Logger::Error, "Invalid event: ", event.eventName);
- return nullptr;
+ throw sdbusplus::exception::SdBusError(
+ EOPNOTSUPP, "Operation not supported in active state");
}
private: