forked from pool/corosync
- corosync exposes itself for a self-crash under rare circumstance(bsc#1078412) Added: 0013-logging-Make-blackbox-configurable.patch 0014-logging-Close-before-and-open-blackbox-after-fork.patch Modified: remove unncessary git commit messages 0001-coroapi-Use-size_t-for-private_data_size.patch 0002-fix-ifdown-udp.patch 0005-do-not-convert-empty-uid-gid-to-0.patch 0008-wd-fix-snprintf-warnings.patch 0010-qdevice-mv-free-str-after-port-validation.patch 0011-libcpg-Fix-issue-with-partial-big-packet-assembly.patch 0012-totemudp-u-Drop-truncated-packets-on-receive.patch OBS-URL: https://build.opensuse.org/request/show/571270 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/corosync?expand=0&rev=133
62 lines
1.4 KiB
Diff
62 lines
1.4 KiB
Diff
diff --git a/exec/logsys.c b/exec/logsys.c
|
|
index a38cc5e8..8c9c222c 100644
|
|
--- a/exec/logsys.c
|
|
+++ b/exec/logsys.c
|
|
@@ -862,3 +862,19 @@ void logsys_blackbox_set(int enable)
|
|
|
|
pthread_mutex_unlock (&logsys_config_mutex);
|
|
}
|
|
+
|
|
+/*
|
|
+ * To set correct pid to qb blackbox filename after tty dettach (fork) we have to
|
|
+ * close (this function) and (if needed) reopen blackbox (logsys_blackbox_postfork function).
|
|
+ */
|
|
+void logsys_blackbox_prefork(void)
|
|
+{
|
|
+
|
|
+ (void)qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_ENABLED, QB_FALSE);
|
|
+}
|
|
+
|
|
+void logsys_blackbox_postfork(void)
|
|
+{
|
|
+
|
|
+ _logsys_config_apply_blackbox();
|
|
+}
|
|
diff --git a/exec/main.c b/exec/main.c
|
|
index cd587dc8..426e56d0 100644
|
|
--- a/exec/main.c
|
|
+++ b/exec/main.c
|
|
@@ -1460,7 +1460,13 @@ int main (int argc, char **argv, char **envp)
|
|
* Now we are fully initialized.
|
|
*/
|
|
if (background) {
|
|
+ logsys_blackbox_prefork();
|
|
+
|
|
corosync_tty_detach ();
|
|
+
|
|
+ logsys_blackbox_postfork();
|
|
+
|
|
+ log_printf (LOGSYS_LEVEL_DEBUG, "Corosync TTY detached");
|
|
}
|
|
|
|
/*
|
|
diff --git a/include/corosync/logsys.h b/include/corosync/logsys.h
|
|
index ec38d2cb..a4aad69b 100644
|
|
--- a/include/corosync/logsys.h
|
|
+++ b/include/corosync/logsys.h
|
|
@@ -258,6 +258,11 @@ extern int logsys_thread_start (void);
|
|
|
|
extern void logsys_blackbox_set(int enable);
|
|
|
|
+extern void logsys_blackbox_prefork(void);
|
|
+
|
|
+extern void logsys_blackbox_postfork(void);
|
|
+
|
|
+
|
|
/**
|
|
* @brief logsys_subsys_id
|
|
*/
|
|
--
|
|
2.13.6
|
|
|