dont remove the socket when the dameon stops. This can race if the
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 9 Jun 2009 02:31:36 +0000 (12:31 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 9 Jun 2009 02:31:36 +0000 (12:31 +1000)
service is immediately restarted

Conflicts:

server/ctdb_daemon.c

server/ctdb_daemon.c

index 8a3f564aa5df0f21f25a38336586043d67e000cf..861c90c851b6e9fe31366ef756c89a535719f024 100644 (file)
@@ -617,15 +617,6 @@ failed:
        return -1;      
 }
 
-/*
-  delete the socket on exit - called on destruction of autofree context
- */
-static int unlink_destructor(const char *name)
-{
-       unlink(name);
-       return 0;
-}
-
 static void sig_child_handler(struct event_context *ev,
        struct signal_event *se, int signum, int count,
        void *dont_care, 
@@ -690,7 +681,10 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
 
        /* ensure the socket is deleted on exit of the daemon */
        domain_socket_name = talloc_strdup(talloc_autofree_context(), ctdb->daemon.name);
-       talloc_set_destructor(domain_socket_name, unlink_destructor);   
+       if (domain_socket_name == NULL) {
+               DEBUG(DEBUG_ALERT,(__location__ " talloc_strdup failed.\n"));
+               exit(12);
+       }
 
        ctdb->ev = event_context_init(NULL);