util: New function ctdb_die()
authorMartin Schwenke <martin@meltin.net>
Sun, 30 Jun 2013 07:42:11 +0000 (17:42 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Fri, 5 Jul 2013 05:52:33 +0000 (15:52 +1000)
This is like ctdb_fatal() but exits cleanly without dumping core or
generating a backtrace.

Signed-off-by: Martin Schwenke <martin@meltin.net>
common/ctdb_util.c
include/ctdb_private.h

index d2bce36af2dbad0dae841dc996e74f02615c04cd..a2da3bccd54e66015372c38a17b7f2187eb35c13 100644 (file)
@@ -59,6 +59,15 @@ void ctdb_fatal(struct ctdb_context *ctdb, const char *msg)
        abort();
 }
 
+/*
+  like ctdb_fatal() but a core/backtrace would not be useful
+*/
+void ctdb_die(struct ctdb_context *ctdb, const char *msg)
+{
+       DEBUG(DEBUG_ALERT,("ctdb exiting with error: %s\n", msg));
+       exit(1);
+}
+
 /* Invoke an external program to do some sort of tracing on the CTDB
  * process.  This might block for a little while.  The external
  * program is specified by the environment variable
index 05109acb6d24f4a0f6d7a323c666b70acffcfa20..1939f07ccebb3658dbc8ecd91653b07de83b0fc6 100644 (file)
@@ -725,6 +725,7 @@ struct ctdb_fetch_handle {
 /* internal prototypes */
 void ctdb_set_error(struct ctdb_context *ctdb, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
 void ctdb_fatal(struct ctdb_context *ctdb, const char *msg);
+void ctdb_die(struct ctdb_context *ctdb, const char *msg);
 void ctdb_external_trace(void);
 bool ctdb_same_address(struct ctdb_address *a1, struct ctdb_address *a2);
 int ctdb_parse_address(struct ctdb_context *ctdb,