summaryrefslogtreecommitdiffstats
path: root/ctdb/server/eventscript.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2008-10-16 17:57:50 +1100
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2008-10-16 17:57:50 +1100
commit5808a7be9647b98d3cfa75ef6f21ce3d821619bb (patch)
treef17e60cc5346b39afcaab6ff49ac35e0d00999a8 /ctdb/server/eventscript.c
parent02f6731454e7fe685e094f99bf9fdf0ffd070979 (diff)
downloadsamba-5808a7be9647b98d3cfa75ef6f21ce3d821619bb.tar.gz
samba-5808a7be9647b98d3cfa75ef6f21ce3d821619bb.tar.xz
samba-5808a7be9647b98d3cfa75ef6f21ce3d821619bb.zip
allow multiple eventscripts using the same prefix.
this eases the pain for users that use out of tree eventscripts (This used to be ctdb commit 8313dfb6fc5404cd2d065af6620412f8664ada11)
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);