From: Ronnie sahlberg Date: Mon, 9 Apr 2007 22:47:39 +0000 (+1000) Subject: add a atexit() call to remove the domain socket when the daemon exits X-Git-Tag: tevent-0.9.20~348^2~2953^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=31ffe0af355f7904ef528a9e5865554b185338c7;p=thirdparty%2Fsamba.git add a atexit() call to remove the domain socket when the daemon exits (This used to be ctdb commit 2f685c68e0b17ed8a290a265ebd64c1d089ceec5) --- diff --git a/ctdb/common/ctdb_daemon.c b/ctdb/common/ctdb_daemon.c index 8ef2366074c..dc1e1477163 100644 --- a/ctdb/common/ctdb_daemon.c +++ b/ctdb/common/ctdb_daemon.c @@ -277,6 +277,14 @@ static int ux_socket_bind(struct ctdb_context *ctdb) return 0; } +static char *domain_socket_name=NULL; +static void unlink_domain_socket(void) +{ + if (domain_socket_name) { + unlink(domain_socket_name); + } +} + /* start the protocol going */ @@ -292,6 +300,9 @@ int ctdbd_start(struct ctdb_context *ctdb) /* get rid of any old sockets */ unlink(ctdb->daemon.name); + domain_socket_name = ctdb->daemon.name; + atexit(unlink_domain_socket); + /* create a unix domain stream socket to listen to */ res = ux_socket_bind(ctdb); if (res!=0) {