ctdb-daemon: Check if method is initialized before calling
authorAmitay Isaacs <amitay@gmail.com>
Mon, 27 Jun 2016 08:00:49 +0000 (18:00 +1000)
committerMartin Schwenke <martins@samba.org>
Tue, 5 Jul 2016 08:53:15 +0000 (10:53 +0200)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/server/ctdb_daemon.c
ctdb/server/ctdb_fork.c

index 0f17b0f..d9275f8 100644 (file)
@@ -1821,7 +1821,7 @@ void ctdb_shutdown_sequence(struct ctdb_context *ctdb, int exit_code)
        ctdb_stop_monitoring(ctdb);
        ctdb_release_all_ips(ctdb);
        ctdb_event_script(ctdb, CTDB_EVENT_SHUTDOWN);
-       if (ctdb->methods != NULL) {
+       if (ctdb->methods != NULL && ctdb->methods->shutdown != NULL) {
                ctdb->methods->shutdown(ctdb);
        }
 
index 93977d9..4edbe88 100644 (file)
@@ -91,7 +91,7 @@ pid_t ctdb_fork(struct ctdb_context *ctdb)
                        close(ctdb->daemon.sd);
                        ctdb->daemon.sd = -1;
                }
-               if (ctdb->methods != NULL) {
+               if (ctdb->methods != NULL && ctdb->methods->shutdown != NULL) {
                        ctdb->methods->shutdown(ctdb);
                }