Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE
pacemaker.29727
0001-Low-libcrmcommon-Fix-problems-with-pcmk__o...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Low-libcrmcommon-Fix-problems-with-pcmk__output_and_.patch of Package pacemaker.29727
From c5b6a64cde5d460e1349e952db6a33831009ecd0 Mon Sep 17 00:00:00 2001 From: Chris Lumens <clumens@redhat.com> Date: Mon, 20 Feb 2023 16:12:19 -0500 Subject: [PATCH] Low: libcrmcommon: Fix problems with pcmk__output_and_clear_error. First, it should take a GError ** so that doing anything in the function modifies the error object that was passed to it. Second, the test case should assert that the error is NULL, not that some element of it is NULL. --- daemons/attrd/pacemaker-attrd.c | 2 +- daemons/based/pacemaker-based.c | 4 ++-- daemons/controld/pacemaker-controld.c | 4 ++-- daemons/execd/cts-exec-helper.c | 4 ++-- daemons/execd/pacemaker-execd.c | 2 +- daemons/fenced/cts-fence-helper.c | 4 ++-- daemons/fenced/pacemaker-fenced.c | 2 +- daemons/pacemakerd/pacemakerd.c | 4 ++-- daemons/schedulerd/pacemaker-schedulerd.c | 4 ++-- include/crm/common/output_internal.h | 2 +- lib/common/output.c | 12 ++++++------ .../tests/output/pcmk__output_and_clear_error_test.c | 6 +++--- tools/attrd_updater.c | 2 +- tools/cibadmin.c | 4 ++-- tools/crm_attribute.c | 2 +- tools/crm_diff.c | 2 +- tools/crm_error.c | 4 ++-- tools/crm_node.c | 4 ++-- tools/crm_resource.c | 2 +- tools/crm_rule.c | 4 ++-- tools/crm_shadow.c | 2 +- tools/crm_simulate.c | 4 ++-- tools/crm_ticket.c | 4 ++-- tools/crm_verify.c | 4 ++-- tools/crmadmin.c | 4 ++-- tools/iso8601.c | 4 ++-- tools/stonith_admin.c | 4 ++-- 27 files changed, 50 insertions(+), 50 deletions(-) Index: pacemaker-2.1.2+20211124.ada5c3b36/daemons/pacemakerd/pacemakerd.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/daemons/pacemakerd/pacemakerd.c +++ pacemaker-2.1.2+20211124.ada5c3b36/daemons/pacemakerd/pacemakerd.c @@ -1,5 +1,5 @@ /* - * Copyright 2010-2021 the Pacemaker project contributors + * Copyright 2010-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -430,7 +430,7 @@ done: g_strfreev(processed_args); pcmk__free_arg_context(context); - pcmk__output_and_clear_error(error, out); + pcmk__output_and_clear_error(&error, out); if (out != NULL) { out->finish(out, exit_code, true, NULL); Index: pacemaker-2.1.2+20211124.ada5c3b36/include/crm/common/output_internal.h =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/include/crm/common/output_internal.h +++ pacemaker-2.1.2+20211124.ada5c3b36/include/crm/common/output_internal.h @@ -854,7 +854,7 @@ G_GNUC_NULL_TERMINATED; * \param[in] out The output functions structure. If NULL, any errors * will simply be printed to stderr. */ -void pcmk__output_and_clear_error(GError *error, pcmk__output_t *out); +void pcmk__output_and_clear_error(GError **error, pcmk__output_t *out); #define PCMK__OUTPUT_SPACER_IF(out_obj, cond) \ if (cond) { \ Index: pacemaker-2.1.2+20211124.ada5c3b36/lib/common/output.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/lib/common/output.c +++ pacemaker-2.1.2+20211124.ada5c3b36/lib/common/output.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the Pacemaker project contributors + * Copyright 2019-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -153,17 +153,17 @@ pcmk__register_messages(pcmk__output_t * } void -pcmk__output_and_clear_error(GError *error, pcmk__output_t *out) +pcmk__output_and_clear_error(GError **error, pcmk__output_t *out) { - if (error == NULL) { + if (error == NULL || *error == NULL) { return; } if (out != NULL) { - out->err(out, "%s: %s", g_get_prgname(), error->message); + out->err(out, "%s: %s", g_get_prgname(), (*error)->message); } else { - fprintf(stderr, "%s: %s\n", g_get_prgname(), error->message); + fprintf(stderr, "%s: %s\n", g_get_prgname(), (*error)->message); } - g_clear_error(&error); + g_clear_error(error); } Index: pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_attribute.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/tools/crm_attribute.c +++ pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_attribute.c @@ -520,6 +520,6 @@ done: cib_delete(the_cib); } - pcmk__output_and_clear_error(error, NULL); + pcmk__output_and_clear_error(&error, NULL); return crm_exit(exit_code); } Index: pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_diff.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/tools/crm_diff.c +++ pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_diff.c @@ -382,6 +382,6 @@ done: free_xml(object_1); free_xml(object_2); - pcmk__output_and_clear_error(error, NULL); + pcmk__output_and_clear_error(&error, NULL); crm_exit(exit_code); } Index: pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_error.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/tools/crm_error.c +++ pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_error.c @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the Pacemaker project contributors + * Copyright 2012-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -150,6 +150,6 @@ main(int argc, char **argv) g_strfreev(processed_args); pcmk__free_arg_context(context); - pcmk__output_and_clear_error(error, NULL); + pcmk__output_and_clear_error(&error, NULL); return exit_code; } Index: pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_node.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/tools/crm_node.c +++ pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_node.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -593,6 +593,6 @@ done: g_strfreev(processed_args); pcmk__free_arg_context(context); - pcmk__output_and_clear_error(error, NULL); + pcmk__output_and_clear_error(&error, NULL); return crm_exit(exit_code); } Index: pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_resource.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/tools/crm_resource.c +++ pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_resource.c @@ -200,7 +200,7 @@ static pcmk__supported_format_t formats[ static crm_exit_t bye(crm_exit_t ec) { - pcmk__output_and_clear_error(error, out); + pcmk__output_and_clear_error(&error, out); if (out != NULL) { out->finish(out, ec, true, NULL); Index: pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_rule.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/tools/crm_rule.c +++ pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_rule.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the Pacemaker project contributors + * Copyright 2019-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -352,6 +352,6 @@ done: pcmk__free_arg_context(context); pe_free_working_set(data_set); - pcmk__output_and_clear_error(error, NULL); + pcmk__output_and_clear_error(&error, NULL); crm_exit(exit_code); } Index: pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_simulate.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/tools/crm_simulate.c +++ pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_simulate.c @@ -1,5 +1,5 @@ /* - * Copyright 2009-2021 the Pacemaker project contributors + * Copyright 2009-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -569,7 +569,7 @@ main(int argc, char **argv) options.dot_file); done: - pcmk__output_and_clear_error(error, NULL); + pcmk__output_and_clear_error(&error, NULL); /* There sure is a lot to free in options. */ free(options.dot_file); Index: pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_verify.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/tools/crm_verify.c +++ pacemaker-2.1.2+20211124.ada5c3b36/tools/crm_verify.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -272,7 +272,7 @@ main(int argc, char **argv) exit_code = pcmk_rc2exitc(rc); } - pcmk__output_and_clear_error(error, NULL); + pcmk__output_and_clear_error(&error, NULL); if (out != NULL) { out->finish(out, exit_code, true, NULL); Index: pacemaker-2.1.2+20211124.ada5c3b36/tools/crmadmin.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/tools/crmadmin.c +++ pacemaker-2.1.2+20211124.ada5c3b36/tools/crmadmin.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2021 the Pacemaker project contributors + * Copyright 2004-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -267,7 +267,7 @@ done: g_strfreev(processed_args); pcmk__free_arg_context(context); - pcmk__output_and_clear_error(error, out); + pcmk__output_and_clear_error(&error, out); if (out != NULL) { out->finish(out, exit_code, true, NULL); Index: pacemaker-2.1.2+20211124.ada5c3b36/tools/stonith_admin.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/tools/stonith_admin.c +++ pacemaker-2.1.2+20211124.ada5c3b36/tools/stonith_admin.c @@ -1,5 +1,5 @@ /* - * Copyright 2009-2021 the Pacemaker project contributors + * Copyright 2009-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -607,7 +607,7 @@ main(int argc, char **argv) g_strfreev(processed_args); pcmk__free_arg_context(context); - pcmk__output_and_clear_error(error, out); + pcmk__output_and_clear_error(&error, out); if (out != NULL) { out->finish(out, exit_code, true, NULL);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor