summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2015-07-21 16:37:04 +1000
committerStefan Metzmacher <metze@samba.org>2015-08-18 10:55:53 +0200
commitdfa6a2d025e68250b49cb1c27ce69fbcbd7bdde8 (patch)
treef2ea6e97bd3308c2fedc2263331d2204439e71a6
parent37e126daf941fd577290e34ac580b5ae0cc4a674 (diff)
downloadsamba-dfa6a2d025e68250b49cb1c27ce69fbcbd7bdde8.tar.gz
ctdb-daemon: Correctly process the exit code from failed eventscripts
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11431 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Wed Jul 22 15:03:53 CEST 2015 on sn-devel-104 (cherry picked from commit 00ec3c477eba50206801b451ae4eb64c12aba5db) Autobuild-User(v4-3-test): Stefan Metzmacher <metze@samba.org> Autobuild-Date(v4-3-test): Tue Aug 18 10:55:54 CEST 2015 on sn-devel-104
-rw-r--r--ctdb/server/ctdb_event_helper.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ctdb/server/ctdb_event_helper.c b/ctdb/server/ctdb_event_helper.c
index f14e336f25c..a1b53188225 100644
--- a/ctdb/server/ctdb_event_helper.c
+++ b/ctdb/server/ctdb_event_helper.c
@@ -128,7 +128,11 @@ int main(int argc, char *argv[])
exit(1);
}
if (WIFEXITED(status)) {
- output = -WEXITSTATUS(status);
+ output = WEXITSTATUS(status);
+ /* Only errors should be returned as -ve values */
+ if (output == ENOENT || output == ENOEXEC) {
+ output = -output;
+ }
sys_write(write_fd, &output, sizeof(output));
exit(0);
}