[Spice-devel] [PATCH spice-streaming-agent] Report initialization errors more precisely

Frediano Ziglio fziglio at redhat.com
Wed Nov 22 16:26:55 UTC 2017


> 
> From: Christophe de Dinechin <dinechin at redhat.com>
> 
> Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
> ---
>  src/concrete-agent.cpp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/concrete-agent.cpp b/src/concrete-agent.cpp
> index 192054a..ddeac8e 100644
> --- a/src/concrete-agent.cpp
> +++ b/src/concrete-agent.cpp
> @@ -89,11 +89,15 @@ void ConcreteAgent::LoadPlugin(const char
> *plugin_filename)
>          PluginInitFunc* init_func =
>              (PluginInitFunc *) dlsym(dl,
>              "spice_streaming_agent_plugin_init");
>          if (!init_func || !init_func(this)) {
> +            syslog(LOG_ERR, "error loading plugin %s: %s",
> +                   plugin_filename,
> +                   init_func ? "module init failed" : "no module init
> function");
>              dlclose(dl);

The init function can return true also if it decided it
cannot work. This can be a normal condition if the specific
plugin require some specific h/w. In this case you should not
have a log.

>          }
>      }
>      catch (std::runtime_error &err) {
> -        syslog(LOG_ERR, "%s", err.what());
> +        syslog(LOG_ERR, "error loading plugin %s: %s",
> +               plugin_filename, err.what());

yes, better and more consistent

>          dlclose(dl);
>      }
>  }

Frediano


More information about the Spice-devel mailing list