[Spice-devel] [PATCH 2/7] reds_init_net: report errors on watch setup failures

Christophe Fergeau cfergeau at redhat.com
Wed Sep 12 07:17:56 PDT 2012


We used to be aborting in such situations, but this was changed
during the big spice_error/printerr cleanup. We are currently
outputting a warning but not reporting the error with the caller
when reds_init_net fails to register listening watches with the
mainloop. As it's unlikely that things will work as expected in
such cases, better to error out of the function instead of pretending
everything is all right.
---
 server/reds.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/server/reds.c b/server/reds.c
index 993a132..202d9c3 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3128,6 +3128,7 @@ static int reds_init_net(void)
                                              reds_accept, NULL);
         if (reds->listen_watch == NULL) {
             spice_warning("set fd handle failed");
+            return -1;
         }
     }
 
@@ -3142,6 +3143,7 @@ static int reds_init_net(void)
                                                     reds_accept_ssl_connection, NULL);
         if (reds->secure_listen_watch == NULL) {
             spice_warning("set fd handle failed");
+            return -1;
         }
     }
 
@@ -3152,6 +3154,7 @@ static int reds_init_net(void)
                                              reds_accept, NULL);
         if (reds->listen_watch == NULL) {
             spice_warning("set fd handle failed");
+            return -1;
         }
     }
     return 0;
-- 
1.7.11.4



More information about the Spice-devel mailing list