From mboxrd@z Thu Jan 1 00:00:00 1970 From: fabbione@sourceware.org Date: 29 Oct 2007 05:48:54 -0000 Subject: [Cluster-devel] cluster/fence/fence_node fence_node.c Message-ID: <20071029054854.6721.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Changes by: fabbione at sourceware.org 2007-10-29 05:48:54 Modified files: fence/fence_node: fence_node.c Log message: Apply, rework and cleanup second part of patch from Marco Ceci to fix 354421 Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fence_node/fence_node.c.diff?cvsroot=cluster&r1=1.9&r2=1.10 --- cluster/fence/fence_node/fence_node.c 2007/08/22 08:58:42 1.9 +++ cluster/fence/fence_node/fence_node.c 2007/10/29 05:48:53 1.10 @@ -18,7 +18,6 @@ #include #include "copyright.cf" -#include "ccs.h" #define OPTION_STRING ("hOuV") @@ -32,9 +31,9 @@ while (0) static char *prog_name; -static int force; +static int force = 0; -int dispatch_fence_agent(int cd, char *victim); +int dispatch_fence_agent(char *victim, int force); static void print_usage(void) { @@ -52,7 +51,7 @@ int main(int argc, char *argv[]) { - int cont = 1, optchar, error, cd; + int cont = 1, optchar, error; char *victim = NULL; prog_name = argv[0]; @@ -104,30 +103,16 @@ if (!victim) die("no node name specified"); - if (force) - cd = ccs_force_connect(NULL, 0); - else - cd = ccs_connect(); - openlog("fence_node", LOG_PID, LOG_USER); - if (cd < 0) { - syslog(LOG_ERR, "cannot connect to ccs %d\n", cd); - goto fail; - } + error = dispatch_fence_agent(victim, force); - error = dispatch_fence_agent(cd, victim); - if (error) - goto fail_ccs; - - syslog(LOG_NOTICE, "Fence of \"%s\" was successful\n", victim); - ccs_disconnect(cd); - exit(EXIT_SUCCESS); - - fail_ccs: - ccs_disconnect(cd); - fail: - syslog(LOG_ERR, "Fence of \"%s\" was unsuccessful\n", victim); - exit(EXIT_FAILURE); + if (error) { + syslog(LOG_ERR, "Fence of \"%s\" was unsuccessful\n", victim); + exit(EXIT_FAILURE); + } else { + syslog(LOG_NOTICE, "Fence of \"%s\" was successful\n", victim); + exit(EXIT_SUCCESS); + } }