Merge commit 'martins-svart/status-test-2' into status-test
[metze/ctdb/wip.git] / server / eventscript.c
index 2cf87af5c8c1631c1169f63f4979027c3215e442..bb6dc4cc2a1288868c588fcf56d1901d08d79584 100644 (file)
@@ -721,7 +721,7 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
                        talloc_free(ctdb->last_monitor_status_ctx);
                        ctdb->last_monitor_status_ctx = NULL;
                }
-               ctdb->last_monitor_status_ctx = ctdb->current_monitor_status_ctx;
+               ctdb->last_monitor_status_ctx = talloc_steal(ctdb, ctdb->current_monitor_status_ctx);
                ctdb->current_monitor_status_ctx = NULL;
        }
 
@@ -817,8 +817,12 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
                        ctdb->current_monitor_status_ctx = NULL;
                }
 
+<<<<<<< HEAD:server/eventscript.c
+               ctdb->current_monitor_status_ctx = talloc(ctdb->monitor_event_script_ctx, struct ctdb_monitor_script_status_ctx);
+=======
                ctdb->current_monitor_status_ctx = talloc(ctdb, struct ctdb_monitor_script_status_ctx);
                CTDB_NO_MEMORY(ctdb, ctdb->current_monitor_status_ctx);
+>>>>>>> martins-svart/status-test-2:server/eventscript.c
                ctdb->current_monitor_status_ctx->scripts = NULL;
        } else {
                /* any other script will first terminate any monitor event */
@@ -827,9 +831,17 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
                        ctdb->monitor_event_script_ctx = NULL;
                }
                /* and then use a context common for all non-monitor events */
+<<<<<<< HEAD:server/eventscript.c
+               if (ctdb->other_event_script_ctx != NULL) {
+                       talloc_free(ctdb->other_event_script_ctx);
+                       ctdb->other_event_script_ctx = NULL;
+               }
+               ctdb->other_event_script_ctx = talloc_new(ctdb);
+=======
                if (ctdb->other_event_script_ctx == NULL) {
                        ctdb->other_event_script_ctx = talloc_new(ctdb);
                }
+>>>>>>> martins-svart/status-test-2:server/eventscript.c
                mem_ctx = ctdb->other_event_script_ctx;
        }
 
@@ -1002,7 +1014,11 @@ static void run_eventscripts_callback(struct ctdb_context *ctdb, int status,
        return;
 }
 
+<<<<<<< HEAD:server/eventscript.c
+
+=======
 /* Returns rest of string, or NULL if no match. */
+>>>>>>> martins-svart/status-test-2:server/eventscript.c
 static const char *get_call(const char *p, enum ctdb_eventscript_call *call)
 {
        unsigned int len;
@@ -1014,10 +1030,21 @@ static const char *get_call(const char *p, enum ctdb_eventscript_call *call)
        for (*call = 0; *call < ARRAY_SIZE(call_names); (*call)++) {
                len = strlen(call_names[*call]);
                if (strncmp(p, call_names[*call], len) == 0) {
+<<<<<<< HEAD:server/eventscript.c
+                       /* If that's it, we're good. */
+                       if (*p == '\0')
+                               return p;
+                       /* Otherwise, if whitespace is next, good. */
+                       len = strspn(p, " \t");
+                       if (len)
+                               return p + len;
+                       /* Hmm, extra chars: keep looking. */
+=======
                        /* If end of string or whitespace, we're done. */
                        if (strcspn(p + len, " \t") == 0) {
                                return p + len;
                        }
+>>>>>>> martins-svart/status-test-2:server/eventscript.c
                }
        }
        return NULL;