File pacemaker-attrd-pacemakerd-libcrmcommon-make-Exiting-last-message.patch of Package pacemaker.19778
commit 45d914f58d936ef2b953efe04d78655a2501abf0
Author: Ken Gaillot <kgaillot@redhat.com>
Date: Tue Jan 30 18:45:08 2018 -0600
Log: attrd,pacemakerd,libcrmcommon: make "Exiting" last message
Previously, pacemakerd would log an "Exiting" message, then call crm_exit(),
which could log more messages. Now, crm_exit() logs the "Exiting" message,
after doing everything else.
This will result in more logs (i.e. every call of crm_exit()), but they will be
at info level, and potentially useful.
Index: pacemaker-1.1.18+20180126.bfe4e8042/attrd/attrd_common.c
===================================================================
--- pacemaker-1.1.18+20180126.bfe4e8042.orig/attrd/attrd_common.c
+++ pacemaker-1.1.18+20180126.bfe4e8042/attrd/attrd_common.c
@@ -43,11 +43,9 @@ attrd_shutting_down()
* \param[in] nsig Ignored
*/
void
-attrd_shutdown(int nsig) {
- crm_info("Shutting down");
-
+attrd_shutdown(int nsig)
+{
shutting_down = TRUE;
-
if ((mloop != NULL) && g_main_is_running(mloop)) {
g_main_quit(mloop);
} else {
Index: pacemaker-1.1.18+20180126.bfe4e8042/lib/common/utils.c
===================================================================
--- pacemaker-1.1.18+20180126.bfe4e8042.orig/lib/common/utils.c
+++ pacemaker-1.1.18+20180126.bfe4e8042/lib/common/utils.c
@@ -83,17 +83,17 @@ int
crm_exit(int rc)
{
mainloop_cleanup();
-
-#if HAVE_LIBXML2
- crm_trace("cleaning up libxml");
crm_xml_cleanup();
-#endif
- crm_trace("exit %d", rc);
qb_log_fini();
free(crm_short_options);
- free(crm_system_name);
+ if (crm_system_name) {
+ crm_info("Exiting %s " CRM_XS " with status %d", crm_system_name, rc);
+ free(crm_system_name);
+ } else {
+ crm_trace("Exiting with status %d", rc);
+ }
exit(ABS(rc)); /* Always exit with a positive value so that it can be passed to crm_error
*
Index: pacemaker-1.1.18+20180126.bfe4e8042/mcp/pacemaker.c
===================================================================
--- pacemaker-1.1.18+20180126.bfe4e8042.orig/mcp/pacemaker.c
+++ pacemaker-1.1.18+20180126.bfe4e8042/mcp/pacemaker.c
@@ -1158,7 +1158,5 @@ main(int argc, char **argv)
cluster_disconnect_cpg(&cluster);
cluster_disconnect_cfg();
- crm_info("Exiting %s", crm_system_name);
-
return crm_exit(rc);
}