[Spice-devel] [PATCH phodav 06/13] spice: print err when g_open fails

Jakub Janků jjanku at redhat.com
Thu May 23 08:37:18 UTC 2019


Don't fail silently when we cannot open the webdav virtio port.

Signed-off-by: Jakub Janků <jjanku at redhat.com>
---
 spice/spice-webdavd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c
index 3fac28b..d9b1fae 100644
--- a/spice/spice-webdavd.c
+++ b/spice/spice-webdavd.c
@@ -24,6 +24,7 @@
 #include <gio/gunixoutputstream.h>
 #include <fcntl.h>
 #include <glib/gstdio.h>
+#include <errno.h>
 #endif
 
 #ifdef G_OS_WIN32
@@ -703,8 +704,12 @@ open_mux_path (const char *path)
   g_debug ("Open %s", path);
 #ifdef G_OS_UNIX
   port_fd = g_open (path, O_RDWR);
+  gint errsv = errno;
   if (port_fd == -1)
+    {
+      g_printerr("Failed to open %s: %s\n", path, g_strerror(errsv));
       exit (1);
+    }
 
   wait_for_virtio_host (port_fd);
 
-- 
2.21.0



More information about the Spice-devel mailing list