summaryrefslogtreecommitdiff
path: root/ctdb/server/eventscript.c
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2013-02-05 14:25:01 +1100
committerAmitay Isaacs <amitay@gmail.com>2013-02-05 16:05:13 +1100
commite8837204610b42ef2c0c38cd880524ec92dee4e9 (patch)
tree526bffed82d0464ac72348f62482c88b5a584257 /ctdb/server/eventscript.c
parentbc5f0a2b651109d1f271d167f8d233763ec4f4a9 (diff)
downloadsamba-e8837204610b42ef2c0c38cd880524ec92dee4e9.tar.gz
ctdbd: Complain loudly if CTDB_DEBUG_HUNG_SCRIPT script isn't executable
This is quite easy to misconfigure by failing to set the execute bit on the script. Better to complain loudly. This is a debugging facilty rather than core CTDB functionality, so it doesn't need a subtle mechanism to disable it at run-time. To disable the designated script at run-time either edit it to put an "exit 0" at the top or move it aside and symlink to /bin/true. This is implemented by actually removing the code that checks that the file exists and is executable. The output from the shell when the system() function fails is just as useful. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 3400b2ed34b6eb9496eb55f1aab6f89d2952060d)
Diffstat (limited to 'ctdb/server/eventscript.c')
-rw-r--r--ctdb/server/eventscript.c12
1 files changed, 0 insertions, 12 deletions
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c
index 24183a41e4c..ae744c834bd 100644
--- a/ctdb/server/eventscript.c
+++ b/ctdb/server/eventscript.c
@@ -531,24 +531,12 @@ static void ctdb_run_debug_hung_script(struct ctdb_context *ctdb, struct ctdb_ev
return;
}
if (pid == 0) {
- struct stat st;
char buf[200];
if (getenv("CTDB_DEBUG_HUNG_SCRIPT") != NULL) {
debug_hung_script = getenv("CTDB_DEBUG_HUNG_SCRIPT");
}
- if (stat(debug_hung_script, &st) != 0) {
- DEBUG(DEBUG_ERR,("Failed to stat the script to debug hung eventscript. Is it not installed correctly? (script:%s)\n", debug_hung_script));
- ctdb_kill(state->ctdb, state->child, SIGTERM);
- _exit(0);
- }
- if (!(st.st_mode & S_IXUSR)) {
- DEBUG(DEBUG_DEBUG,("Debug script %s is not executable.\n", debug_hung_script));
- ctdb_kill(state->ctdb, state->child, SIGTERM);
- _exit(0);
- }
-
sprintf(buf, "%s %d", debug_hung_script, state->child);
system(buf);