[Spice-devel] [vd_agent] vdagentd: Make the 'could not create server socket' message more helpful

Francois Gouget fgouget at codeweavers.com
Wed Nov 2 15:36:40 UTC 2016


EADDRINUSE usually means the socket file was left behind after a crash.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 src/vdagentd/vdagentd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c
index 8dee414..13a84ce 100644
--- a/src/vdagentd/vdagentd.c
+++ b/src/vdagentd/vdagentd.c
@@ -970,8 +970,13 @@ int main(int argc, char *argv[])
                                  vdagentd_messages, VDAGENTD_NO_MESSAGES,
                                  debug);
     if (!server) {
-        syslog(LOG_CRIT, "Fatal could not create server socket %s",
-               vdagentd_socket);
+        if (errno == EADDRINUSE) {
+            syslog(LOG_CRIT, "Fatal the server socket %s exists already. Delete it?",
+                   vdagentd_socket);
+        } else {
+            syslog(LOG_CRIT, "Fatal could not create the server socket %s: %m",
+                   vdagentd_socket);
+        }
         return 1;
     }
     if (chmod(vdagentd_socket, 0666)) {
-- 
2.10.1



More information about the Spice-devel mailing list