tools: Avoiding printing "(null)" on "ctdb eventscript" error
authorMartin Schwenke <martin@meltin.net>
Mon, 6 Jul 2015 01:48:28 +0000 (11:48 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Thu, 16 Jul 2015 04:36:49 +0000 (14:36 +1000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(Imported from commit b71d18d2dc090e99d67c6bd8552380b44f8db810)

tools/ctdb.c

index 82f095d8c0d2ba4df8c571e1895e5e6aefdc30cd..ebbe84e70c4d2252db6819e79a6b322010d117f2 100644 (file)
@@ -5515,7 +5515,12 @@ static int control_eventscript(struct ctdb_context *ctdb, int argc, const char *
        ret = ctdb_control(ctdb, options.pnn, 0, CTDB_CONTROL_RUN_EVENTSCRIPTS,
                           0, data, tmp_ctx, NULL, &res, NULL, &errmsg);
        if (ret != 0 || res != 0) {
-               DEBUG(DEBUG_ERR,("Failed to run eventscripts - %s\n", errmsg));
+               if (errmsg != NULL) {
+                       DEBUG(DEBUG_ERR,
+                             ("Failed to run eventscripts - %s\n", errmsg));
+               } else {
+                       DEBUG(DEBUG_ERR, ("Failed to run eventscripts\n"));
+               }
                talloc_free(tmp_ctx);
                return -1;
        }