[Spice-devel] [PATCH 17/22] Catch all std::exception derivatives

Christophe de Dinechin christophe at dinechin.org
Wed Feb 28 15:43:20 UTC 2018


From: Christophe de Dinechin <dinechin at redhat.com>

std::bad_alloc is not an std::runtime_exception, it was not caught before.
We do not catch(...) on purpose, since calling 'terminate' and the abort()
that results is probably the best course of action in case some unknown
exception is thrown, if only because we can get a core dump.

Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
---
 src/spice-streaming-agent.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index 1c5b6c1..9048935 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -633,7 +633,7 @@ int main(int argc, char* argv[])
         err.syslog();
         ret = EXIT_FAILURE;
     }
-    catch (std::runtime_error &err) {
+    catch (std::exception &err) {
         syslog(LOG_ERR, "%s\n", err.what());
         ret = EXIT_FAILURE;
     }
-- 
2.13.5 (Apple Git-94)



More information about the Spice-devel mailing list