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

Lukas Venhoda lvenhoda at redhat.com
Thu Aug 27 09:25:51 PDT 2015


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.
---
Removed the exit, because g_error already aborts.
---
 spice/spice-webdavd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c
index c8fb795..b3fd1ea 100644
--- a/spice/spice-webdavd.c
+++ b/spice/spice-webdavd.c
@@ -722,7 +722,9 @@ 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 ()));

   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



More information about the Spice-devel mailing list