From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23434 invoked by alias); 27 Apr 2009 14:00:21 -0000 Received: (qmail 23428 invoked by alias); 27 Apr 2009 14:00:20 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_57,SPF_HELO_PASS X-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_57,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: cluster: master - notifyd: add const and proper function prototypes To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 283b629de47f2a42dc91d33fb9c9e7bdc2d3603d X-Git-Newrev: 77b0fcc2ee9b8de43d067ba312dea23967b57a98 From: "Fabio M. Di Nitto" Message-Id: <20090427135948.5198D120301@lists.fedorahosted.org> Date: Mon, 27 Apr 2009 14:00:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q2/txt/msg00122.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=77b0fcc2ee9b8de43d067ba312dea23967b57a98 Commit: 77b0fcc2ee9b8de43d067ba312dea23967b57a98 Parent: 283b629de47f2a42dc91d33fb9c9e7bdc2d3603d Author: Fabio M. Di Nitto AuthorDate: Mon Apr 27 15:56:26 2009 +0200 Committer: Fabio M. Di Nitto CommitterDate: Mon Apr 27 15:59:35 2009 +0200 notifyd: add const and proper function prototypes Signed-off-by: Fabio M. Di Nitto --- cman/notifyd/main.c | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cman/notifyd/main.c b/cman/notifyd/main.c index da34f5a..d5c90c5 100644 --- a/cman/notifyd/main.c +++ b/cman/notifyd/main.c @@ -32,7 +32,7 @@ int rr = 0; #define MAX_ARGS 128 #endif -static void print_usage() +static void print_usage(void) { printf("Usage:\n\n"); printf("cmannotifyd [options]\n\n"); @@ -212,7 +212,7 @@ static void init_logging(int reconf) logt_conf("cmannotifyd", mode, syslog_facility, syslog_priority, logfile_priority, logfile); } -static void dispatch_notification(char *str, int *quorum) +static void dispatch_notification(const char *str, int *quorum) { char *envp[MAX_ARGS]; char *argv[MAX_ARGS]; @@ -240,7 +240,7 @@ static void dispatch_notification(char *str, int *quorum) envp[envptr--] = NULL; - argv[argvptr++] = "cman_notify"; + argv[argvptr++] = strdup("cman_notify"); argv[argvptr--] = NULL; @@ -271,13 +271,19 @@ out: envptr--; } + while(argvptr >= 0) { + if (argv[argvptr]) + free(argv[argvptr]); + + argvptr--; + } if (err) exit(EXIT_FAILURE); } static void cman_callback(cman_handle_t ch, void *private, int reason, int arg) { - char *str = NULL; + const char *str = NULL; switch (reason) { case CMAN_REASON_TRY_SHUTDOWN: @@ -302,7 +308,7 @@ static void cman_callback(cman_handle_t ch, void *private, int reason, int arg) } } -static void byebye_cman() +static void byebye_cman(void) { if (!cman_handle) return; @@ -356,7 +362,7 @@ out: exit(EXIT_SUCCESS); } -static void loop() +static void loop(void) { int cd_result, se_result; fd_set read_fds;