diff options
author | Amitay Isaacs <amitay@gmail.com> | 2014-01-23 14:57:53 +1100 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2014-01-31 15:57:49 +1100 |
commit | 1566790e5a738f12db1dfb519589c1842d74b8e5 (patch) | |
tree | bae7218cff902da79e6261085ee052069917936d | |
parent | b112a3317cbedc73a6e17b3f711fec84f0d41d4e (diff) | |
download | samba-1566790e5a738f12db1dfb519589c1842d74b8e5.tar.gz samba-1566790e5a738f12db1dfb519589c1842d74b8e5.tar.xz samba-1566790e5a738f12db1dfb519589c1842d74b8e5.zip |
ctdb-daemon: Return negative status only if there are known errors
If event script does not exist or does not have execute permissions, then
return negative errno to distinguish from the exit errors of event script.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
-rw-r--r-- | ctdb/server/ctdb_event_helper.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ctdb/server/ctdb_event_helper.c b/ctdb/server/ctdb_event_helper.c index 4c62e41af63..ab1eae44091 100644 --- a/ctdb/server/ctdb_event_helper.c +++ b/ctdb/server/ctdb_event_helper.c @@ -127,7 +127,10 @@ int main(int argc, char *argv[]) waitpid(pid, &status, 0); if (WIFEXITED(status)) { - output = -WEXITSTATUS(status); + output = WEXITSTATUS(status); + if (output == ENOENT || output == ENOEXEC) { + output = -output; + } write(write_fd, &output, sizeof(output)); exit(output); } |