[Crash-utility] [PATCH 2/2] Change constructor and destructor functions of extensions/trace.c to be static

Tao Liu ltao at redhat.com
Fri Mar 26 10:10:02 UTC 2021


Previously extensions/trace.so with two different names loaded by "extend"
command twice will segfault crash.

This patch fixed the problem by making related functions static.

Signed-off-by: Tao Liu <ltao at redhat.com>
---
 extensions/trace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/extensions/trace.c b/extensions/trace.c
index c33907f..23a9667 100644
--- a/extensions/trace.c
+++ b/extensions/trace.c
@@ -1888,7 +1888,7 @@ static struct command_table_entry command_table[] = {
 
 static int ftrace_initialized;
 
-void __attribute__((constructor))
+static void __attribute__((constructor))
 trace_init(void)
 {
 	if (ftrace_init() < 0)
@@ -1898,7 +1898,7 @@ trace_init(void)
 	register_extension(command_table);
 }
 
-void __attribute__((destructor))
+static void __attribute__((destructor))
 trace_fini(void)
 {
 	if (ftrace_initialized)
-- 
2.29.2




More information about the Crash-utility mailing list