From 2e549a0f96a897455aa0ee9a6b3922ec9ce40f93 Mon Sep 17 00:00:00 2001 From: gardners Date: Thu, 3 May 2012 11:10:23 +0930 Subject: [PATCH] Switching to abstract name space for socket to get around permission denied errors. --- monitor.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index dcf6b3f8..e9926525 100644 --- a/monitor.c +++ b/monitor.c @@ -67,11 +67,12 @@ int monitor_setup_sockets() name.sun_family = AF_UNIX; if (monitor_named_socket==-1) { - if (!form_serval_instance_path(&name.sun_path[0], 100, "monitor.socket")) { + name.sun_path[0]=0; + if (!form_serval_instance_path(&name.sun_path[1], 100, "monitor.socket")) { return WHY("Cannot construct name of unix domain socket."); } - unlink(&name.sun_path[0]); - len = 0+strlen(&name.sun_path[0]) + sizeof(name.sun_family)+1; + if (name.sun_path[0]) unlink(&name.sun_path[0]); + len = 1+strlen(&name.sun_path[1]) + sizeof(name.sun_family)+1; monitor_named_socket = socket(AF_UNIX, SOCK_STREAM, 0); if (monitor_named_socket>-1) { int dud=0; @@ -168,6 +169,7 @@ int monitor_poll() monitor_socket_count++; write(s,"MONITOR:You are talking to servald\n", strlen("MONITOR:You are talking to servald\n")); + WHY("Got a client"); } fcntl(monitor_named_socket,F_SETFL, fcntl(monitor_named_socket, F_GETFL, NULL)&(~O_NONBLOCK));