Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > d236c5da97a239a1b6991cfba2865b66 > files > 16

cman-2.0.115-68.el5_6.1.src.rpm

From efcafee5e61ee01748d9f1d2d971f72def2ce089 Mon Sep 17 00:00:00 2001
From: Christine Caulfield <ccaulfie@redhat.com>
Date: Mon, 9 Aug 2010 13:47:48 -0400
Subject: [PATCH] cman: Change flags to be values instead of bitmasks

Leaveflags was being evaluated as bitwise operations
when it should have been simple equality checks.

Resolves: rhbz#595394

Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
 cman/daemon/commands.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index b1b1c69..6ffe9e5 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -2,7 +2,7 @@
 *******************************************************************************
 **
 **  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
-**  Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2010 Red Hat, Inc.  All rights reserved.
 **
 **  This copyrighted material is made available to anyone wishing to use,
 **  modify, copy, or redistribute it subject to the terms and conditions
@@ -842,12 +842,12 @@ static int do_cmd_leave_cluster(char *cmdbuf, int *retlen)
 	memcpy(&leave_flags, cmdbuf, sizeof(int));
 
 	/* Ignore the use count if FORCE is set */
-	if (!(leave_flags & CLUSTER_LEAVEFLAG_FORCE)) {
+	if (!(leave_flags == CLUSTER_LEAVEFLAG_FORCE)) {
 		if (use_count)
 			return -ENOTCONN;
 	}
 
-	us->leave_reason = leave_flags;
+	us->leave_reason = (leave_flags & 0xF);
 	quit_threads = 1;
 
 	/* No messaging available yet, just die */
@@ -875,7 +875,7 @@ static void check_shutdown_status()
 		    shutdown_flags & SHUTDOWN_ANYWAY) {
 			quit_threads = 1;
 			if (shutdown_flags & SHUTDOWN_REMOVE)
-				leaveflags |= CLUSTER_LEAVEFLAG_REMOVED;
+				leaveflags = CLUSTER_LEAVEFLAG_REMOVED;
 			send_leave(leaveflags);
 			reply = 0;
 		}
@@ -952,7 +952,7 @@ static int do_cmd_try_shutdown(struct connection *con, char *cmdbuf)
 
 		quit_threads = 1;
 		if (shutdown_flags & SHUTDOWN_REMOVE)
-			leaveflags |= CLUSTER_LEAVEFLAG_REMOVED;
+			leaveflags = CLUSTER_LEAVEFLAG_REMOVED;
 
 		send_leave(leaveflags);
 		return 0;
@@ -2040,7 +2040,7 @@ void del_ais_node(int nodeid)
 		memset(&node->port_bits, 0, sizeof(node->port_bits));
 		cluster_members--;
 
-		if ((node->leave_reason & 0xF) & CLUSTER_LEAVEFLAG_REMOVED)
+		if (node->leave_reason == CLUSTER_LEAVEFLAG_REMOVED)
 			recalculate_quorum(1, 1);
 		else
 			recalculate_quorum(0, 0);
-- 
1.7.2