ctdb-daemon: Set ctdb->notification_script directly
authorMartin Schwenke <martin@meltin.net>
Thu, 29 Mar 2018 03:50:17 +0000 (14:50 +1100)
committerMartin Schwenke <martins@samba.org>
Tue, 1 May 2018 11:31:18 +0000 (13:31 +0200)
This doesn't need a wrapper function.  It gets in the way if building
a value involves allocating memory (e.g. talloc_asprintf()) and then
ctdb_set_notification_script() duplicates that memory.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdbd.c

index 68e7e7d045586949cfd422d74b65491e32b01c07..38a5f9d39358e5bf0668fe92f7459123cc40ce11 100644 (file)
@@ -308,9 +308,10 @@ int main(int argc, const char *argv[])
        }
 
        if (options.notification_script != NULL) {
-               ret = ctdb_set_notification_script(ctdb, options.notification_script);
-               if (ret == -1) {
-                       DEBUG(DEBUG_ERR,("Unable to setup notification script\n"));
+               ctdb->notification_script = talloc_strdup(
+                               ctdb, options.notification_script);
+               if (ctdb->notification_script == NULL) {
+                       D_ERR("Unable to set notification script\n");
                        exit(1);
                }
        }