[Spice-devel] [phodav PATCH 1/2] spice-webdavd: Show error msg when CreateFile fails

Marc-André Lureau mlureau at redhat.com
Wed Aug 12 11:08:45 PDT 2015


hi

----- Original Message -----
> Adds a popup error message on Windows, when CreateFile() fails.
> 
> CreateFile can fail when webdavd is run without administrator privileges
> on windows. Assert doesn't provide any kind of error message to user,
> when started without those privileges.
> ---
>  spice/spice-webdavd.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c
> index c8fb795..368bb44 100644
> --- a/spice/spice-webdavd.c
> +++ b/spice/spice-webdavd.c
> @@ -722,7 +722,12 @@ open_mux_path (const char *path)
>                           OPEN_EXISTING,
>                           FILE_FLAG_OVERLAPPED,
>                           NULL);
> -  g_assert (port_handle != INVALID_HANDLE_VALUE);
> +
> +  if (port_handle == INVALID_HANDLE_VALUE)
> +    {
> +      g_error ("%s", g_win32_error_message (GetLastError ()));
> +      exit (1);

g_error should be no return already, I think exit(1) is unnecessary,

ack anyway

> +    }
> 
>    mux_ostream = G_OUTPUT_STREAM (g_win32_output_stream_new (port_handle,
>    TRUE));
>    mux_istream = G_INPUT_STREAM (g_win32_input_stream_new (port_handle,
>    TRUE));
> --
> 2.4.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list