summaryrefslogtreecommitdiffstats
path: root/ctdb/server/eventscript.c
diff options
context:
space:
mode:
Diffstat (limited to 'ctdb/server/eventscript.c')
-rw-r--r--ctdb/server/eventscript.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c
index 057bc8077c..deaf750a33 100644
--- a/ctdb/server/eventscript.c
+++ b/ctdb/server/eventscript.c
@@ -67,6 +67,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *options)
DIR *dir;
struct dirent *de;
char *script;
+ int count;
if (ctdb->recovery_mode != CTDB_RECOVERY_NORMAL) {
/* we guarantee that only some specifically allowed event scripts are run
@@ -118,6 +119,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *options)
return -1;
}
+ count = 0;
while ((de=readdir(dir)) != NULL) {
int namlen;
unsigned num;
@@ -154,14 +156,8 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *options)
}
- /* store the event script in the tree */
- script = trbt_insert32(tree, num, talloc_strdup(tree, de->d_name));
- if (script != NULL) {
- DEBUG(DEBUG_CRIT,("CONFIG ERROR: Multiple event scripts with the same prefix : '%s' and '%s'. Each event script MUST have a unique prefix\n", script, de->d_name));
- talloc_free(tmp_ctx);
- closedir(dir);
- return -1;
- }
+ /* store the event script in the tree */
+ trbt_insert32(tree, (num<<16)|count++, talloc_strdup(tree, de->d_name));
}
closedir(dir);