On Thu, 2018-06-14 at 05:31 -0400, Frediano Ziglio wrote: > > > > Unify the error handling to use exceptions, narrowing down the exit > > spots for success/error to one each. > > > > Signed-off-by: Lukáš Hrázký <lhrazky@xxxxxxxxxx> > > --- > > src/spice-streaming-agent.cpp | 17 +++++++---------- > > 1 file changed, 7 insertions(+), 10 deletions(-) > > > > diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp > > index fe26f70..94419b0 100644 > > --- a/src/spice-streaming-agent.cpp > > +++ b/src/spice-streaming-agent.cpp > > @@ -474,14 +474,14 @@ int main(int argc, char* argv[]) > > } > > } > > > > + register_interrupts(); > > + > > try { > > // register built-in plugins > > MjpegPlugin::Register(&agent); > > > > agent.LoadPlugins(pluginsdir); > > > > - register_interrupts(); > > - > > FrameLog frame_log(log_filename, log_binary, log_frames); > > > > for (const std::string& arg: old_args) { > > This register_interrupts() change seems to be off topic here. Not entirely, it is more a part of the initial setup than the business code and cannot throw. I can move it out to a separate patch, I just didn't feel like splitting it too much. > > @@ -491,19 +491,16 @@ int main(int argc, char* argv[]) > > > > Display *display = XOpenDisplay(NULL); > > if (display == NULL) { > > - syslog(LOG_ERR, "failed to open display\n"); > > - return EXIT_FAILURE; > > + throw Error("Failed to open X display"); > > } > > + > > int event_base, error_base; > > if (!XFixesQueryExtension(display, &event_base, &error_base)) { > > - syslog(LOG_ERR, "XFixesQueryExtension failed\n"); > > - return EXIT_FAILURE; > > + throw Error("XFixesQueryExtension failed"); > > } > > Window rootwindow = DefaultRootWindow(display); > > XFixesSelectCursorInput(display, rootwindow, > > XFixesDisplayCursorNotifyMask); > > > > - int ret = EXIT_SUCCESS; > > - > > StreamPort stream_port(stream_port_name); > > > > std::thread cursor_th(cursor_changes, &stream_port, display, > > event_base); > > @@ -513,8 +510,8 @@ int main(int argc, char* argv[]) > > } > > catch (std::exception &err) { > > syslog(LOG_ERR, "%s\n", err.what()); > > - ret = EXIT_FAILURE; > > + return EXIT_FAILURE; > > } > > > > - return ret; > > + return EXIT_SUCCESS; > > } > > This makes 7/9 compile. > > Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel