summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukáš Hrázký <lhrazky@redhat.com>2018-06-12 14:48:40 +0200
committerLukáš Hrázký <lhrazky@redhat.com>2018-07-02 12:21:13 +0200
commitc656735898732044750165f960f8022871330867 (patch)
treeed26a9c90ef8af0f83d243c90f8ff4edd37bf447
parent6bec4723e7205cb714550cb79f20f917b3c864e3 (diff)
Make the try-catch block in main() a catch-all
Extends the try-catch block to encompass all the business code in main(), making it a catch-all for all errors. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r--src/spice-streaming-agent.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index 0a7edbe..e0a8459 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -459,36 +459,36 @@ int main(int argc, char* argv[])
}
}
- // register built-in plugins
- MjpegPlugin::Register(&agent);
+ int ret = EXIT_SUCCESS;
- agent.LoadPlugins(pluginsdir);
+ try {
+ // register built-in plugins
+ MjpegPlugin::Register(&agent);
- register_interrupts();
+ agent.LoadPlugins(pluginsdir);
- FrameLog frame_log(log_filename, log_binary, log_frames);
+ register_interrupts();
- for (const std::string& arg: old_args) {
- frame_log.log_stat("Args: %s", arg.c_str());
- }
- old_args.clear();
+ FrameLog frame_log(log_filename, log_binary, log_frames);
- Display *display = XOpenDisplay(NULL);
- if (display == NULL) {
- syslog(LOG_ERR, "failed to open display\n");
- return EXIT_FAILURE;
- }
- int event_base, error_base;
- if (!XFixesQueryExtension(display, &event_base, &error_base)) {
- syslog(LOG_ERR, "XFixesQueryExtension failed\n");
- return EXIT_FAILURE;
- }
- Window rootwindow = DefaultRootWindow(display);
- XFixesSelectCursorInput(display, rootwindow, XFixesDisplayCursorNotifyMask);
+ for (const std::string& arg: old_args) {
+ frame_log.log_stat("Args: %s", arg.c_str());
+ }
+ old_args.clear();
- int ret = EXIT_SUCCESS;
+ Display *display = XOpenDisplay(NULL);
+ if (display == NULL) {
+ syslog(LOG_ERR, "failed to open display\n");
+ return EXIT_FAILURE;
+ }
+ int event_base, error_base;
+ if (!XFixesQueryExtension(display, &event_base, &error_base)) {
+ syslog(LOG_ERR, "XFixesQueryExtension failed\n");
+ return EXIT_FAILURE;
+ }
+ Window rootwindow = DefaultRootWindow(display);
+ XFixesSelectCursorInput(display, rootwindow, XFixesDisplayCursorNotifyMask);
- try {
StreamPort stream_port(stream_port_name);
std::thread cursor_th(cursor_changes, &stream_port, display, event_base);