1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00

eventscript: enhance script delete race check

We currently assume 127 == script removed.  The script can also return 127;
best to re-check the execution status in this case (and for 126, which will
happen if the script is non-executable).

If the script is no longer executable/not present, we ignore it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 0a53d6b5ac81daf0efa32f35e7758ede2a5bdb63)
This commit is contained in:
Rusty Russell 2009-12-07 23:09:02 +10:30
parent 8993d6f523
commit ce378014c7

View File

@ -588,9 +588,13 @@ static int ctdb_run_event_script(struct ctdb_context *ctdb,
if (ret != -1) {
ret = WEXITSTATUS(ret);
}
if (ret == 127) {
ret = 0;
DEBUG(DEBUG_ERR,("Script %s returned status 127. Someone just deleted it?\n", cmdstr));
if (ret == 127 || ret == 126) {
/* Re-check it... */
if (!check_executable(ctdb->event_script_dir,
current->name)) {
ret = 0;
DEBUG(DEBUG_ERR,("Script %s returned status 127. Someone just deleted it?\n", cmdstr));
}
}
if (!from_user && call == CTDB_EVENT_MONITOR) {