[Openais] [PATCH] LINT: fix or ignore unchecked return values.
Steven Dake
sdake at redhat.com
Mon Nov 10 21:53:22 PST 2008
cfgtool has some wierd tab formatting
can you fix and then this one is good for commit.
Regards
-steve
On Mon, 2008-11-10 at 09:17 +1300, angus salkeld wrote:
> If we don't care about the return value then typecast the return
> value to void.
> Else do something useful with the return value.
>
> ---
> exec/logsys.c | 6 ++--
> exec/main.c | 16 +++++-----
> lib/cfg.c | 36 ++++++++++++------------
> lib/confdb.c | 68 +++++++++++++++++++++++-----------------------
> lib/cpg.c | 34 +++++++++++-----------
> lib/evs.c | 26 +++++++++---------
> lib/pload.c | 16 +++++-----
> lib/quorum.c | 26 +++++++++---------
> lib/util.c | 2 +-
> tools/corosync-cfgtool.c | 36 +++++++++++++-----------
> tools/corosync-fplay.c | 8 +++++-
> tools/corosync-objctl.c | 12 +++++---
> 12 files changed, 149 insertions(+), 137 deletions(-)
>
> diff --git a/exec/logsys.c b/exec/logsys.c
> index 099821f..ced821e 100644
> --- a/exec/logsys.c
> +++ b/exec/logsys.c
> @@ -302,7 +302,7 @@ static void log_printf_to_logs (
>
> case 't':
> gettimeofday (&tv, NULL);
> - strftime (char_time, sizeof (char_time), "%b %e %k:%M:%S", localtime ((time_t *)&tv.tv_sec));
> + (void)strftime (char_time, sizeof (char_time), "%b %e %k:%M:%S", localtime ((time_t *)&tv.tv_sec));
> len = strcpy_cutoff (&output_buffer[output_buffer_idx], char_time, cutoff);
> output_buffer_idx += len;
> break;
> @@ -342,7 +342,7 @@ static void log_printf_to_logs (
> /*
> * Output to a file
> */
> - fwrite (output_buffer, strlen (output_buffer), 1, logsys_file_fp);
> + (void)fwrite (output_buffer, strlen (output_buffer), 1, logsys_file_fp);
> fflush (logsys_file_fp);
> }
>
> @@ -350,7 +350,7 @@ static void log_printf_to_logs (
> * Output to stderr
> */
> if (logsys_mode & LOG_MODE_OUTPUT_STDERR) {
> - write (STDERR_FILENO, output_buffer, strlen (output_buffer));
> + (void)write (STDERR_FILENO, output_buffer, strlen (output_buffer));
> }
> }
>
> diff --git a/exec/main.c b/exec/main.c
> index 6062c7a..f31ddce 100644
> --- a/exec/main.c
> +++ b/exec/main.c
> @@ -171,7 +171,7 @@ static void sigquit_handler (int num)
>
> static void sigsegv_handler (int num)
> {
> - signal (SIGSEGV, SIG_DFL);
> + (void)signal (SIGSEGV, SIG_DFL);
> logsys_atsegv();
> logsys_log_rec_store ("/var/lib/corosync/fdata");
> raise (SIGSEGV);
> @@ -179,7 +179,7 @@ static void sigsegv_handler (int num)
>
> static void sigabrt_handler (int num)
> {
> - signal (SIGABRT, SIG_DFL);
> + (void)signal (SIGABRT, SIG_DFL);
> logsys_atsegv();
> logsys_log_rec_store ("/var/lib/corosync/fdata");
> raise (SIGABRT);
> @@ -344,7 +344,7 @@ static void aisexec_tty_detach (void)
> }
>
> /* Create new session */
> - setsid();
> + (void)setsid();
>
> /*
> * Map stdin/out/err to /dev/null.
> @@ -529,11 +529,11 @@ int main (int argc, char **argv)
> log_printf (LOG_LEVEL_NOTICE, "Copyright (C) 2002-2006 MontaVista Software, Inc and contributors.\n");
> log_printf (LOG_LEVEL_NOTICE, "Copyright (C) 2006-2008 Red Hat, Inc.\n");
>
> - signal (SIGINT, sigintr_handler);
> - signal (SIGUSR2, sigusr2_handler);
> - signal (SIGSEGV, sigsegv_handler);
> - signal (SIGABRT, sigabrt_handler);
> - signal (SIGQUIT, sigquit_handler);
> + (void)signal (SIGINT, sigintr_handler);
> + (void)signal (SIGUSR2, sigusr2_handler);
> + (void)signal (SIGSEGV, sigsegv_handler);
> + (void)signal (SIGABRT, sigabrt_handler);
> + (void)signal (SIGQUIT, sigquit_handler);
>
> corosync_timer_init (
> serialize_mutex_lock,
> diff --git a/lib/cfg.c b/lib/cfg.c
> index a5d456d..ff1c552 100644
> --- a/lib/cfg.c
> +++ b/lib/cfg.c
> @@ -130,14 +130,14 @@ corosync_cfg_initialize (
>
> pthread_mutex_init (&cfg_instance->dispatch_mutex, NULL);
>
> - saHandleInstancePut (&cfg_hdb, *cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, *cfg_handle);
>
> return (CS_OK);
>
> error_put_destroy:
> - saHandleInstancePut (&cfg_hdb, *cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, *cfg_handle);
> error_destroy:
> - saHandleDestroy (&cfg_hdb, *cfg_handle);
> + (void)saHandleDestroy (&cfg_hdb, *cfg_handle);
> error_no_destroy:
> return (error);
> }
> @@ -157,7 +157,7 @@ corosync_cfg_fd_get (
>
> *selection_fd = cfg_instance->dispatch_fd;
>
> - saHandleInstancePut (&cfg_hdb, cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, cfg_handle);
> return (CS_OK);
> }
>
> @@ -295,7 +295,7 @@ corosync_cfg_dispatch (
> } while (cont);
>
> error_unlock:
> - saHandleInstancePut (&cfg_hdb, cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, cfg_handle);
> error_nounlock:
> return (error);
> }
> @@ -322,7 +322,7 @@ corosync_cfg_finalize (
> if (cfg_instance->finalize) {
> pthread_mutex_unlock (&cfg_instance->response_mutex);
> pthread_mutex_unlock (&cfg_instance->dispatch_mutex);
> - saHandleInstancePut (&cfg_hdb, cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, cfg_handle);
> return (CS_ERR_BAD_HANDLE);
> }
>
> @@ -336,7 +336,7 @@ corosync_cfg_finalize (
>
> pthread_mutex_destroy (&cfg_instance->dispatch_mutex);
>
> - saHandleDestroy (&cfg_hdb, cfg_handle);
> + (void)saHandleDestroy (&cfg_hdb, cfg_handle);
>
> if (cfg_instance->response_fd != -1) {
> shutdown (cfg_instance->response_fd, 0);
> @@ -347,7 +347,7 @@ corosync_cfg_finalize (
> close (cfg_instance->dispatch_fd);
> }
>
> - saHandleInstancePut (&cfg_hdb, cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, cfg_handle);
>
> return (error);
> }
> @@ -427,7 +427,7 @@ error_free_interface_names:
> free (*interface_names);
>
> no_error:
> - saHandleInstancePut (&cfg_hdb, cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, cfg_handle);
>
> return (error);
> }
> @@ -458,7 +458,7 @@ corosync_cfg_ring_reenable (
> sizeof (struct res_lib_cfg_ringreenable));
>
> pthread_mutex_unlock (&cfg_instance->response_mutex);
> - saHandleInstancePut (&cfg_hdb, cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, cfg_handle);
>
> return (error);
> }
> @@ -496,7 +496,7 @@ corosync_cfg_service_load (
> sizeof (struct res_lib_cfg_serviceload));
>
> pthread_mutex_unlock (&cfg_instance->response_mutex);
> - saHandleInstancePut (&cfg_hdb, cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, cfg_handle);
>
> return (error);
> }
> @@ -534,7 +534,7 @@ corosync_cfg_service_unload (
> sizeof (struct res_lib_cfg_serviceunload));
>
> pthread_mutex_unlock (&cfg_instance->response_mutex);
> - saHandleInstancePut (&cfg_hdb, cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, cfg_handle);
>
> return (error);
> }
> @@ -570,7 +570,7 @@ corosync_cfg_state_track (
>
> pthread_mutex_unlock (&cfg_instance->response_mutex);
>
> - saHandleInstancePut (&cfg_hdb, cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, cfg_handle);
>
> return (error == CS_OK ? res_lib_cfg_statetrack.header.error : error);
> }
> @@ -603,7 +603,7 @@ corosync_cfg_state_track_stop (
>
> pthread_mutex_unlock (&cfg_instance->response_mutex);
>
> - saHandleInstancePut (&cfg_hdb, cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, cfg_handle);
>
> return (error == CS_OK ? res_lib_cfg_statetrackstop.header.error : error);
> }
> @@ -639,7 +639,7 @@ corosync_cfg_admin_state_get (
>
> pthread_mutex_unlock (&cfg_instance->response_mutex);
>
> - saHandleInstancePut (&cfg_hdb, cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, cfg_handle);
>
> return (error == CS_OK ? res_lib_cfg_administrativestateget.header.error : error);
> }
> @@ -676,7 +676,7 @@ corosync_cfg_admin_state_set (
>
> pthread_mutex_unlock (&cfg_instance->response_mutex);
>
> - saHandleInstancePut (&cfg_hdb, cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, cfg_handle);
>
> return (error == CS_OK ? res_lib_cfg_administrativestateset.header.error : error);
> }
> @@ -717,7 +717,7 @@ corosync_cfg_kill_node (
>
> pthread_mutex_unlock (&cfg_instance->response_mutex);
>
> - saHandleInstancePut (&cfg_hdb, cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, cfg_handle);
>
> return (error == CS_OK ? res_lib_cfg_killnode.header.error : error);
> }
> @@ -750,7 +750,7 @@ corosync_cfg_try_shutdown (
>
> pthread_mutex_unlock (&cfg_instance->response_mutex);
>
> - saHandleInstancePut (&cfg_hdb, cfg_handle);
> + (void)saHandleInstancePut (&cfg_hdb, cfg_handle);
>
> return (error == CS_OK ? res_lib_cfg_tryshutdown.header.error : error);
> }
> diff --git a/lib/confdb.c b/lib/confdb.c
> index 20c0970..d717885 100644
> --- a/lib/confdb.c
> +++ b/lib/confdb.c
> @@ -99,7 +99,7 @@ static void free_context_list(struct confdb_inst *confdb_inst, struct list_head
> iter != list; iter = tmp, tmp = iter->next) {
>
> context = list_entry (iter, struct iter_context, list);
> - do_find_destroy(confdb_inst, context->find_handle);
> + (void)do_find_destroy(confdb_inst, context->find_handle);
> free(context);
> }
> }
> @@ -175,14 +175,14 @@ cs_error_t confdb_initialize (
> list_init (&confdb_inst->object_iter_head);
> list_init (&confdb_inst->key_iter_head);
>
> - saHandleInstancePut (&confdb_handle_t_db, *handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, *handle);
>
> return (CS_OK);
>
> error_put_destroy:
> - saHandleInstancePut (&confdb_handle_t_db, *handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, *handle);
> error_destroy:
> - saHandleDestroy (&confdb_handle_t_db, *handle);
> + (void)saHandleDestroy (&confdb_handle_t_db, *handle);
> error_no_destroy:
> return (error);
> }
> @@ -205,7 +205,7 @@ cs_error_t confdb_finalize (
> */
> if (confdb_inst->finalize) {
> pthread_mutex_unlock (&confdb_inst->response_mutex);
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
> return (CS_ERR_BAD_HANDLE);
> }
>
> @@ -213,7 +213,7 @@ cs_error_t confdb_finalize (
>
> pthread_mutex_unlock (&confdb_inst->response_mutex);
>
> - saHandleDestroy (&confdb_handle_t_db, handle);
> + (void)saHandleDestroy (&confdb_handle_t_db, handle);
>
> /* Free saved context handles */
> free_context_list(confdb_inst, &confdb_inst->object_find_head);
> @@ -233,7 +233,7 @@ cs_error_t confdb_finalize (
> close(confdb_inst->dispatch_fd);
> }
> }
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (CS_OK);
> }
> @@ -252,7 +252,7 @@ cs_error_t confdb_fd_get (
>
> *fd = confdb_inst->dispatch_fd;
>
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (CS_OK);
> }
> @@ -271,7 +271,7 @@ cs_error_t confdb_context_get (
>
> *context = confdb_inst->context;
>
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (CS_OK);
> }
> @@ -290,7 +290,7 @@ cs_error_t confdb_context_set (
>
> confdb_inst->context = context;
>
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (CS_OK);
> }
> @@ -470,7 +470,7 @@ cs_error_t confdb_dispatch (
> } while (cont);
>
> error_unlock:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
> error_nounlock:
> return (error);
> }
> @@ -526,7 +526,7 @@ cs_error_t confdb_object_create (
> *object_handle = res_lib_confdb_object_create.object_handle;
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -574,7 +574,7 @@ cs_error_t confdb_object_destroy (
> error = res.error;
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -624,7 +624,7 @@ cs_error_t confdb_object_parent_get (
> *parent_object_handle = res_lib_confdb_object_parent_get.parent_object_handle;
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -693,7 +693,7 @@ cs_error_t confdb_object_find_destroy(
> free(context);
> }
>
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
> return error;
> }
>
> @@ -717,7 +717,7 @@ cs_error_t confdb_object_iter_destroy(
> free(context);
> }
>
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
> return error;
> }
>
> @@ -775,7 +775,7 @@ cs_error_t confdb_key_create (
> error = res.error;
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -833,7 +833,7 @@ cs_error_t confdb_key_delete (
> error = res.error;
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -893,7 +893,7 @@ cs_error_t confdb_key_get (
> }
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -951,7 +951,7 @@ cs_error_t confdb_key_increment (
> }
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -1009,7 +1009,7 @@ cs_error_t confdb_key_decrement (
> }
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -1071,7 +1071,7 @@ cs_error_t confdb_key_replace (
> error = res.error;
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -1103,11 +1103,11 @@ cs_error_t confdb_object_iter_start (
>
> /* Start a new find context */
> if (context->find_handle) {
> - do_find_destroy(confdb_inst, context->find_handle);
> + (void)do_find_destroy(confdb_inst, context->find_handle);
> context->find_handle = 0;
> }
>
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> ret:
> return error;
> @@ -1140,7 +1140,7 @@ cs_error_t confdb_key_iter_start (
> context->find_handle = 0;
> context->next_entry = 0;
>
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> ret:
> return error;
> @@ -1172,11 +1172,11 @@ cs_error_t confdb_object_find_start (
> }
> /* Start a new find context */
> if (context->find_handle) {
> - do_find_destroy(confdb_inst, context->find_handle);
> + (void)do_find_destroy(confdb_inst, context->find_handle);
> context->find_handle = 0;
> }
>
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> ret:
> return error;
> @@ -1245,7 +1245,7 @@ cs_error_t confdb_object_find (
> context->find_handle = res_lib_confdb_object_find.find_handle;
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -1318,7 +1318,7 @@ cs_error_t confdb_object_iter (
> sa_exit:
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -1391,7 +1391,7 @@ sa_exit:
> context->next_entry++;
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -1440,7 +1440,7 @@ cs_error_t confdb_write (
> memcpy(error_text, res_lib_confdb_write.error.value, res_lib_confdb_write.error.length);
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -1492,7 +1492,7 @@ cs_error_t confdb_reload (
> memcpy(error_text, res_lib_confdb_reload.error.value, res_lib_confdb_reload.error.length);
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -1539,7 +1539,7 @@ cs_error_t confdb_track_changes (
> error = res.error;
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> @@ -1581,7 +1581,7 @@ cs_error_t confdb_stop_track_changes (confdb_handle_t handle)
> error = res.error;
>
> error_exit:
> - saHandleInstancePut (&confdb_handle_t_db, handle);
> + (void)saHandleInstancePut (&confdb_handle_t_db, handle);
>
> return (error);
> }
> diff --git a/lib/cpg.c b/lib/cpg.c
> index 05aaa1a..08989d4 100644
> --- a/lib/cpg.c
> +++ b/lib/cpg.c
> @@ -120,14 +120,14 @@ cs_error_t cpg_initialize (
>
> pthread_mutex_init (&cpg_inst->dispatch_mutex, NULL);
>
> - saHandleInstancePut (&cpg_handle_t_db, *handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, *handle);
>
> return (CS_OK);
>
> error_put_destroy:
> - saHandleInstancePut (&cpg_handle_t_db, *handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, *handle);
> error_destroy:
> - saHandleDestroy (&cpg_handle_t_db, *handle);
> + (void)saHandleDestroy (&cpg_handle_t_db, *handle);
> error_no_destroy:
> return (error);
> }
> @@ -150,7 +150,7 @@ cs_error_t cpg_finalize (
> */
> if (cpg_inst->finalize) {
> pthread_mutex_unlock (&cpg_inst->response_mutex);
> - saHandleInstancePut (&cpg_handle_t_db, handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, handle);
> return (CS_ERR_BAD_HANDLE);
> }
>
> @@ -158,7 +158,7 @@ cs_error_t cpg_finalize (
>
> pthread_mutex_unlock (&cpg_inst->response_mutex);
>
> - saHandleDestroy (&cpg_handle_t_db, handle);
> + (void)saHandleDestroy (&cpg_handle_t_db, handle);
>
> /*
> * Disconnect from the server
> @@ -171,7 +171,7 @@ cs_error_t cpg_finalize (
> shutdown(cpg_inst->dispatch_fd, 0);
> close(cpg_inst->dispatch_fd);
> }
> - saHandleInstancePut (&cpg_handle_t_db, handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, handle);
>
> return (CS_OK);
> }
> @@ -190,7 +190,7 @@ cs_error_t cpg_fd_get (
>
> *fd = cpg_inst->dispatch_fd;
>
> - saHandleInstancePut (&cpg_handle_t_db, handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, handle);
>
> return (CS_OK);
> }
> @@ -209,7 +209,7 @@ cs_error_t cpg_context_get (
>
> *context = cpg_inst->context;
>
> - saHandleInstancePut (&cpg_handle_t_db, handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, handle);
>
> return (CS_OK);
> }
> @@ -228,7 +228,7 @@ cs_error_t cpg_context_set (
>
> cpg_inst->context = context;
>
> - saHandleInstancePut (&cpg_handle_t_db, handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, handle);
>
> return (CS_OK);
> }
> @@ -451,7 +451,7 @@ cs_error_t cpg_dispatch (
> } while (cont);
>
> error_unlock:
> - saHandleInstancePut (&cpg_handle_t_db, handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, handle);
> error_nounlock:
> return (error);
> }
> @@ -514,7 +514,7 @@ cs_error_t cpg_join (
> error = res_lib_cpg_join.header.error;
>
> error_exit:
> - saHandleInstancePut (&cpg_handle_t_db, handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, handle);
>
> return (error);
> }
> @@ -556,7 +556,7 @@ cs_error_t cpg_leave (
> error = res_lib_cpg_leave.header.error;
>
> error_exit:
> - saHandleInstancePut (&cpg_handle_t_db, handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, handle);
>
> return (error);
> }
> @@ -618,7 +618,7 @@ cs_error_t cpg_mcast_joined (
> error = res_lib_cpg_mcast.header.error;
>
> error_exit:
> - saHandleInstancePut (&cpg_handle_t_db, handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, handle);
>
> return (error);
> }
> @@ -674,7 +674,7 @@ cs_error_t cpg_membership_get (
> }
>
> error_exit:
> - saHandleInstancePut (&cpg_handle_t_db, handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, handle);
>
> return (error);
> }
> @@ -716,7 +716,7 @@ cs_error_t cpg_local_get (
> *local_nodeid = res_lib_cpg_local_get.local_nodeid;
>
> error_exit:
> - saHandleInstancePut (&cpg_handle_t_db, handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, handle);
>
> return (error);
> }
> @@ -758,7 +758,7 @@ cs_error_t cpg_groups_get (
>
> /* Real output is delivered via a callback */
> error_exit:
> - saHandleInstancePut (&cpg_handle_t_db, handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, handle);
>
> return (error);
> }
> @@ -777,7 +777,7 @@ cs_error_t cpg_flow_control_state_get (
>
> *flow_control_state = cpg_inst->flow_control_state;
>
> - saHandleInstancePut (&cpg_handle_t_db, handle);
> + (void)saHandleInstancePut (&cpg_handle_t_db, handle);
>
> return (error);
> }
> diff --git a/lib/evs.c b/lib/evs.c
> index c0dcdb7..46eb7b5 100644
> --- a/lib/evs.c
> +++ b/lib/evs.c
> @@ -130,14 +130,14 @@ cs_error_t evs_initialize (
>
> pthread_mutex_init (&evs_inst->dispatch_mutex, NULL);
>
> - saHandleInstancePut (&evs_handle_t_db, *handle);
> + (void)saHandleInstancePut (&evs_handle_t_db, *handle);
>
> return (CS_OK);
>
> error_put_destroy:
> - saHandleInstancePut (&evs_handle_t_db, *handle);
> + (void)saHandleInstancePut (&evs_handle_t_db, *handle);
> error_destroy:
> - saHandleDestroy (&evs_handle_t_db, *handle);
> + (void)saHandleDestroy (&evs_handle_t_db, *handle);
> error_no_destroy:
> return (error);
> }
> @@ -160,7 +160,7 @@ cs_error_t evs_finalize (
> */
> if (evs_inst->finalize) {
> pthread_mutex_unlock (&evs_inst->response_mutex);
> - saHandleInstancePut (&evs_handle_t_db, handle);
> + (void)saHandleInstancePut (&evs_handle_t_db, handle);
> return (CS_ERR_BAD_HANDLE);
> }
>
> @@ -168,7 +168,7 @@ cs_error_t evs_finalize (
>
> pthread_mutex_unlock (&evs_inst->response_mutex);
>
> - saHandleDestroy (&evs_handle_t_db, handle);
> + (void)saHandleDestroy (&evs_handle_t_db, handle);
> /*
> * Disconnect from the server
> */
> @@ -180,7 +180,7 @@ cs_error_t evs_finalize (
> shutdown(evs_inst->dispatch_fd, 0);
> close(evs_inst->dispatch_fd);
> }
> - saHandleInstancePut (&evs_handle_t_db, handle);
> + (void)saHandleInstancePut (&evs_handle_t_db, handle);
>
>
> return (CS_OK);
> @@ -200,7 +200,7 @@ cs_error_t evs_fd_get (
>
> *fd = evs_inst->dispatch_fd;
>
> - saHandleInstancePut (&evs_handle_t_db, handle);
> + (void)saHandleInstancePut (&evs_handle_t_db, handle);
>
> return (CS_OK);
> }
> @@ -354,7 +354,7 @@ cs_error_t evs_dispatch (
> } while (cont);
>
> error_unlock:
> - saHandleInstancePut (&evs_handle_t_db, handle);
> + (void)saHandleInstancePut (&evs_handle_t_db, handle);
> error_nounlock:
> return (error);
> }
> @@ -399,7 +399,7 @@ cs_error_t evs_join (
> error = res_lib_evs_join.header.error;
>
> error_exit:
> - saHandleInstancePut (&evs_handle_t_db, handle);
> + (void)saHandleInstancePut (&evs_handle_t_db, handle);
>
> return (error);
> }
> @@ -444,7 +444,7 @@ cs_error_t evs_leave (
> error = res_lib_evs_leave.header.error;
>
> error_exit:
> - saHandleInstancePut (&evs_handle_t_db, handle);
> + (void)saHandleInstancePut (&evs_handle_t_db, handle);
>
> return (error);
> }
> @@ -497,7 +497,7 @@ cs_error_t evs_mcast_joined (
> error = res_lib_evs_mcast_joined.header.error;
>
> error_exit:
> - saHandleInstancePut (&evs_handle_t_db, handle);
> + (void)saHandleInstancePut (&evs_handle_t_db, handle);
>
> return (error);
> }
> @@ -551,7 +551,7 @@ cs_error_t evs_mcast_groups (
> error = res_lib_evs_mcast_groups.header.error;
>
> error_exit:
> - saHandleInstancePut (&evs_handle_t_db, handle);
> + (void)saHandleInstancePut (&evs_handle_t_db, handle);
>
> return (error);
> }
> @@ -606,7 +606,7 @@ cs_error_t evs_membership_get (
> }
>
> error_exit:
> - saHandleInstancePut (&evs_handle_t_db, handle);
> + (void)saHandleInstancePut (&evs_handle_t_db, handle);
>
> return (error);
> }
> diff --git a/lib/pload.c b/lib/pload.c
> index 0d1a90b..15e0624 100644
> --- a/lib/pload.c
> +++ b/lib/pload.c
> @@ -115,14 +115,14 @@ unsigned int pload_initialize (
>
> pthread_mutex_init (&pload_inst->dispatch_mutex, NULL);
>
> - saHandleInstancePut (&pload_handle_t_db, *handle);
> + (void)saHandleInstancePut (&pload_handle_t_db, *handle);
>
> return (CS_OK);
>
> error_put_destroy:
> - saHandleInstancePut (&pload_handle_t_db, *handle);
> + (void)saHandleInstancePut (&pload_handle_t_db, *handle);
> error_destroy:
> - saHandleDestroy (&pload_handle_t_db, *handle);
> + (void)saHandleDestroy (&pload_handle_t_db, *handle);
> error_no_destroy:
> return (error);
> }
> @@ -145,7 +145,7 @@ unsigned int pload_finalize (
> */
> if (pload_inst->finalize) {
> pthread_mutex_unlock (&pload_inst->response_mutex);
> - saHandleInstancePut (&pload_handle_t_db, handle);
> + (void)saHandleInstancePut (&pload_handle_t_db, handle);
> return (PLOAD_ERR_BAD_HANDLE);
> }
>
> @@ -153,7 +153,7 @@ unsigned int pload_finalize (
>
> pthread_mutex_unlock (&pload_inst->response_mutex);
>
> - saHandleDestroy (&pload_handle_t_db, handle);
> + (void)saHandleDestroy (&pload_handle_t_db, handle);
> /*
> * Disconnect from the server
> */
> @@ -165,7 +165,7 @@ unsigned int pload_finalize (
> shutdown(pload_inst->dispatch_fd, 0);
> close(pload_inst->dispatch_fd);
> }
> - saHandleInstancePut (&pload_handle_t_db, handle);
> + (void)saHandleInstancePut (&pload_handle_t_db, handle);
>
>
> return (PLOAD_OK);
> @@ -185,7 +185,7 @@ unsigned int pload_fd_get (
>
> *fd = pload_inst->dispatch_fd;
>
> - saHandleInstancePut (&pload_handle_t_db, handle);
> + (void)saHandleInstancePut (&pload_handle_t_db, handle);
>
> return (CS_OK);
> }
> @@ -230,7 +230,7 @@ unsigned int pload_start (
> error = res_lib_pload_start.header.error;
>
> error_exit:
> - saHandleInstancePut (&pload_handle_t_db, handle);
> + (void)saHandleInstancePut (&pload_handle_t_db, handle);
>
> return (error);
> }
> diff --git a/lib/quorum.c b/lib/quorum.c
> index 348878d..6471913 100644
> --- a/lib/quorum.c
> +++ b/lib/quorum.c
> @@ -110,14 +110,14 @@ cs_error_t quorum_initialize (
> else
> memset(&quorum_inst->callbacks, 0, sizeof (callbacks));
>
> - saHandleInstancePut (&quorum_handle_t_db, *handle);
> + (void)saHandleInstancePut (&quorum_handle_t_db, *handle);
>
> return (CS_OK);
>
> error_put_destroy:
> - saHandleInstancePut (&quorum_handle_t_db, *handle);
> + (void)saHandleInstancePut (&quorum_handle_t_db, *handle);
> error_destroy:
> - saHandleDestroy (&quorum_handle_t_db, *handle);
> + (void)saHandleDestroy (&quorum_handle_t_db, *handle);
> error_no_destroy:
> return (error);
> }
> @@ -140,7 +140,7 @@ cs_error_t quorum_finalize (
> */
> if (quorum_inst->finalize) {
> pthread_mutex_unlock (&quorum_inst->response_mutex);
> - saHandleInstancePut (&quorum_handle_t_db, handle);
> + (void)saHandleInstancePut (&quorum_handle_t_db, handle);
> return (CS_ERR_BAD_HANDLE);
> }
>
> @@ -148,7 +148,7 @@ cs_error_t quorum_finalize (
>
> pthread_mutex_unlock (&quorum_inst->response_mutex);
>
> - saHandleDestroy (&quorum_handle_t_db, handle);
> + (void)saHandleDestroy (&quorum_handle_t_db, handle);
>
> /*
> * Disconnect from the server
> @@ -157,7 +157,7 @@ cs_error_t quorum_finalize (
> shutdown(quorum_inst->response_fd, 0);
> close(quorum_inst->response_fd);
> }
> - saHandleInstancePut (&quorum_handle_t_db, handle);
> + (void)saHandleInstancePut (&quorum_handle_t_db, handle);
>
> return (CS_OK);
> }
> @@ -199,7 +199,7 @@ cs_error_t quorum_getquorate (
> *quorate = res_lib_quorum_getquorate.quorate;
>
> error_exit:
> - saHandleInstancePut (&quorum_handle_t_db, handle);
> + (void)saHandleInstancePut (&quorum_handle_t_db, handle);
>
> return (error);
> }
> @@ -218,7 +218,7 @@ cs_error_t quorum_fd_get (
>
> *fd = quorum_inst->dispatch_fd;
>
> - saHandleInstancePut (&quorum_handle_t_db, handle);
> + (void)saHandleInstancePut (&quorum_handle_t_db, handle);
>
> return (CS_OK);
> }
> @@ -238,7 +238,7 @@ cs_error_t quorum_context_get (
>
> *context = quorum_inst->context;
>
> - saHandleInstancePut (&quorum_handle_t_db, handle);
> + (void)saHandleInstancePut (&quorum_handle_t_db, handle);
>
> return (CS_OK);
> }
> @@ -257,7 +257,7 @@ cs_error_t quorum_context_set (
>
> quorum_inst->context = context;
>
> - saHandleInstancePut (&quorum_handle_t_db, handle);
> + (void)saHandleInstancePut (&quorum_handle_t_db, handle);
>
> return (CS_OK);
> }
> @@ -299,7 +299,7 @@ cs_error_t quorum_trackstart (
> error = res.error;
>
> error_exit:
> - saHandleInstancePut (&quorum_handle_t_db, handle);
> + (void)saHandleInstancePut (&quorum_handle_t_db, handle);
>
> return (error);
> }
> @@ -338,7 +338,7 @@ cs_error_t quorum_trackstop (
> error = res.error;
>
> error_exit:
> - saHandleInstancePut (&quorum_handle_t_db, handle);
> + (void)saHandleInstancePut (&quorum_handle_t_db, handle);
>
> return (error);
> }
> @@ -488,6 +488,6 @@ error_unlock:
> pthread_mutex_unlock (&quorum_inst->dispatch_mutex);
>
> error_put:
> - saHandleInstancePut (&quorum_handle_t_db, handle);
> + (void)saHandleInstancePut (&quorum_handle_t_db, handle);
> return (error);
> }
> diff --git a/lib/util.c b/lib/util.c
> index ad61f33..94085af 100644
> --- a/lib/util.c
> +++ b/lib/util.c
> @@ -630,7 +630,7 @@ saHandleDestroy (
>
> pthread_mutex_unlock (&handleDatabase->mutex);
>
> - saHandleInstancePut (handleDatabase, inHandle);
> + (void)saHandleInstancePut (handleDatabase, inHandle);
>
> return (error);
> }
> diff --git a/tools/corosync-cfgtool.c b/tools/corosync-cfgtool.c
> index f3c2fcf..148938c 100644
> --- a/tools/corosync-cfgtool.c
> +++ b/tools/corosync-cfgtool.c
> @@ -65,18 +65,20 @@ static void ringstatusget_do (void)
> exit (1);
> }
>
> - corosync_cfg_ring_status_get (handle,
> - &interface_names,
> - &interface_status,
> - &interface_count);
> -
> - for (i = 0; i < interface_count; i++) {
> - printf ("RING ID %d\n", i);
> - printf ("\tid\t= %s\n", interface_names[i]);
> - printf ("\tstatus\t= %s\n", interface_status[i]);
> + result = corosync_cfg_ring_status_get (handle,
> + &interface_names,
> + &interface_status,
> + &interface_count);
> + if (result != CS_OK) {
> + printf ("Could not get the ring status, the error is: %d\n", result);
> + } else {
> + for (i = 0; i < interface_count; i++) {
> + printf ("RING ID %d\n", i);
> + printf ("\tid\t= %s\n", interface_names[i]);
> + printf ("\tstatus\t= %s\n", interface_status[i]);
> + }
> }
> -
> - corosync_cfg_finalize (handle);
> + (void)corosync_cfg_finalize (handle);
> }
>
> static void ringreenable_do (void)
> @@ -96,7 +98,7 @@ static void ringreenable_do (void)
> printf ("Could not reenable ring error %d\n", result);
> }
>
> - corosync_cfg_finalize (handle);
> + (void)corosync_cfg_finalize (handle);
> }
>
> void service_load_do (char *service, unsigned int version)
> @@ -114,7 +116,7 @@ void service_load_do (char *service, unsigned int version)
> if (result != CS_OK) {
> printf ("Could not load service (error = %d)\n", result);
> }
> - corosync_cfg_finalize (handle);
> + (void)corosync_cfg_finalize (handle);
> }
>
> void service_unload_do (char *service, unsigned int version)
> @@ -132,14 +134,14 @@ void service_unload_do (char *service, unsigned int version)
> if (result != CS_OK) {
> printf ("Could not unload service (error = %d)\n", result);
> }
> - corosync_cfg_finalize (handle);
> + (void)corosync_cfg_finalize (handle);
> }
>
> void shutdown_callback (corosync_cfg_handle_t cfg_handle, CorosyncCfgShutdownFlagsT flags)
> {
> printf("shutdown callback called, flags = %d\n",flags);
>
> - corosync_cfg_replyto_shutdown (cfg_handle, COROSYNC_CFG_SHUTDOWN_FLAG_YES);
> + (void)corosync_cfg_replyto_shutdown (cfg_handle, COROSYNC_CFG_SHUTDOWN_FLAG_YES);
> }
>
> void *shutdown_dispatch_thread(void *arg)
> @@ -187,7 +189,7 @@ void shutdown_do()
> printf ("Could not shutdown (error = %d)\n", result);
> }
>
> - corosync_cfg_finalize (handle);
> + (void)corosync_cfg_finalize (handle);
> }
>
> void killnode_do(unsigned int nodeid)
> @@ -205,7 +207,7 @@ void killnode_do(unsigned int nodeid)
> if (result != CS_OK) {
> printf ("Could not kill node (error = %d)\n", result);
> }
> - corosync_cfg_finalize (handle);
> + (void)corosync_cfg_finalize (handle);
> }
>
>
> diff --git a/tools/corosync-fplay.c b/tools/corosync-fplay.c
> index b00eef0..b9c7272 100644
> --- a/tools/corosync-fplay.c
> +++ b/tools/corosync-fplay.c
> @@ -453,10 +453,16 @@ int main (void)
> int rec_idx;
> int end_rec;
> int record_count = 1;
> + int size_read;
>
> flt_data = malloc ((flt_data_size + 2) * sizeof (unsigned int));
> fd = open ("/var/lib/corosync/fdata", O_RDONLY);
> - read (fd, flt_data, (flt_data_size + 2) * sizeof (unsigned int));
> + size_read = (int)read (fd, flt_data, (flt_data_size + 2) * sizeof (unsigned int));
> +
> + if (size_read != (flt_data_size + 2) * sizeof (unsigned int)) {
> + printf ("Warning: read %d bytes, but expected %d\n",
> + size_read, (flt_data_size + 2) * sizeof (unsigned int));
> + }
>
> rec_idx = flt_data[FDTAIL_INDEX];
> end_rec = flt_data[FDHEAD_INDEX];
> diff --git a/tools/corosync-objctl.c b/tools/corosync-objctl.c
> index 5d46d21..07c275f 100644
> --- a/tools/corosync-objctl.c
> +++ b/tools/corosync-objctl.c
> @@ -453,7 +453,10 @@ static void listen_for_object_changes(confdb_handle_t handle)
> int quit = CS_FALSE;
>
> FD_ZERO (&read_fds);
> - confdb_fd_get(handle, &select_fd);
> + if (confdb_fd_get (handle, &select_fd) != CS_OK) {
> + printf ("can't get the confdb selector object.\n");
> + return;
> + }
> printf ("Type \"q\" to finish\n");
> do {
> FD_SET (select_fd, &read_fds);
> @@ -465,8 +468,9 @@ static void listen_for_object_changes(confdb_handle_t handle)
> if (FD_ISSET (STDIN_FILENO, &read_fds)) {
> char inbuf[3];
>
> - fgets(inbuf, sizeof(inbuf), stdin);
> - if (strncmp(inbuf, "q", 1) == 0)
> + if (fgets(inbuf, sizeof(inbuf), stdin) == NULL)
> + quit = CS_TRUE;
> + else if (strncmp(inbuf, "q", 1) == 0)
> quit = CS_TRUE;
> }
> if (FD_ISSET (select_fd, &read_fds)) {
> @@ -475,7 +479,7 @@ static void listen_for_object_changes(confdb_handle_t handle)
> }
> } while (result && quit == CS_FALSE);
>
> - confdb_stop_track_changes(handle);
> + (void)confdb_stop_track_changes(handle);
>
> }
>
More information about the Openais
mailing list