summaryrefslogtreecommitdiff
path: root/ctdb/server/ctdb_recover.c
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2016-04-01 14:35:15 +1100
committerAmitay Isaacs <amitay@samba.org>2016-04-28 09:39:16 +0200
commit14a2330692a4d2e0058e72f9ea8b1c61ed920344 (patch)
treee67b2b7d80f116c181c946bdf43aeb016dd1b326 /ctdb/server/ctdb_recover.c
parent4842b6bb91f3f3b13f2433f222678f84832a29d2 (diff)
downloadsamba-14a2330692a4d2e0058e72f9ea8b1c61ed920344.tar.gz
ctdb-recovery: Use single char ASCII numbers for status from child
'0' = Child took the mutex '1' = Unable to take mutex - contention '2' = Unable to take mutex - timeout '3' = Unable to take mutex - error This is a straightforward API. When the child is generalised to an external helper then this makes it easier for a helper to be, for example, a simple script. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/server/ctdb_recover.c')
-rw-r--r--ctdb/server/ctdb_recover.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c
index 81c152b63a7..a355f9f744c 100644
--- a/ctdb/server/ctdb_recover.c
+++ b/ctdb/server/ctdb_recover.c
@@ -800,7 +800,7 @@ static void cluster_mutex_handler(struct tevent_context *ev,
{
struct ctdb_cluster_mutex_handle *h=
talloc_get_type(private_data, struct ctdb_cluster_mutex_handle);
- char c = 0;
+ char c = '0';
int ret;
int status = 0;
const char *err = NULL;
@@ -813,14 +813,14 @@ static void cluster_mutex_handler(struct tevent_context *ev,
ret = sys_read(h->fd[0], &c, 1);
if (ret == 1) {
- /* Child wrote status. EACCES indicates that it was unable
+ /* Child wrote status. '1' indicates that it was unable
* to take the lock, which is the expected outcome.
- * 0 indicates that it was able to take the
+ * '0' indicates that it was able to take the
* lock, which is an error because the recovery daemon
* should be holding the lock. */
double l = timeval_elapsed(&h->start_time);
- if (c == EACCES) {
+ if (c == '1') {
status = 0;
err = NULL;
@@ -974,7 +974,7 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
}
if (h->child == 0) {
- char cc = EACCES;
+ char cc = '1';
close(h->fd[0]);
prctl_set_comment("ctdb_recmode");
@@ -986,7 +986,7 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
("ERROR: Daemon able to take recovery lock on \"%s\" during recovery\n",
ctdb->recovery_lock_file));
ctdb_recovery_unlock(ctdb);
- cc = 0;
+ cc = '0';
}
sys_write(h->fd[1], &cc, 1);