summaryrefslogtreecommitdiffstats
path: root/avahi-daemon/simple-protocol.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-06-21 23:45:41 +0000
committerLennart Poettering <lennart@poettering.net>2005-06-21 23:45:41 +0000
commit0612e247a644046a01b018534cfc27e4af1d13e6 (patch)
tree68eb264997489b8a033a69172fde6855086062f6 /avahi-daemon/simple-protocol.c
parent7d0391c1e7e158b9f60614b95c1d7fefde1b70a7 (diff)
* remove stale UNIX sockets before creating new ones
* make sure to flush outbound records after conflict detection git-svn-id: file:///home/lennart/svn/public/avahi/trunk@141 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-daemon/simple-protocol.c')
-rw-r--r--avahi-daemon/simple-protocol.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/avahi-daemon/simple-protocol.c b/avahi-daemon/simple-protocol.c
index 8bd8da4..c41e07c 100644
--- a/avahi-daemon/simple-protocol.c
+++ b/avahi-daemon/simple-protocol.c
@@ -386,6 +386,13 @@ int simple_protocol_setup(GMainContext *c) {
sa.sun_family = AF_LOCAL;
strncpy(sa.sun_path, UNIX_SOCKET, sizeof(sa.sun_path)-1);
+ /* We simply remove existing UNIX sockets under this name. The
+ Avahi daemons makes sure that it runs only once on a host,
+ therefore sockets that already exist are stale and may be
+ removed without any ill effects */
+
+ unlink(UNIX_SOCKET);
+
if (bind(server->fd, &sa, sizeof(sa)) < 0) {
avahi_log_warn("bind(): %s", strerror(errno));
goto fail;