[phodav,06/13] spice: print err when g_open fails

Submitted by Jakub Janku on May 23, 2019, 8:37 a.m.

Details

Message ID 20190523083725.1554-7-jjanku@redhat.com
State New
Headers show
Series "Miscellaneous series" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Jakub Janku May 23, 2019, 8:37 a.m.
Don't fail silently when we cannot open the webdav virtio port.

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

Patch hide | download patch | download mbox

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);
 

Comments

On Thu, May 23, 2019 at 10:37 AM Jakub Janků <jjanku@redhat.com> wrote:
>
> Don't fail silently when we cannot open the webdav virtio port.
>
> Signed-off-by: Jakub Janků <jjanku@redhat.com>

ack

> ---
>  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
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel