summaryrefslogtreecommitdiffstats
path: root/CRT.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2023-04-04 16:47:11 +1000
committerBenBE <BenBE@geshi.org>2023-04-06 00:19:54 +0200
commit14da84f877a0f3627ddaea836c9537b2292fa22d (patch)
treed8eff482c76709187482e41eb36628b5de935078 /CRT.c
parente7f447b6a3473a572d3e6c191128f1796477860d (diff)
Refactor to use a program name pointer instead of PACKAGE macro
During SEGV handling under pcp-htop several incorrect strings were observed - in particular reporting htop as the binary name instead of pcp-htop. This is something we want to be crystal clear on when we request user stack traces etc, so make sure this cannot be done incorrectly.
Diffstat (limited to 'CRT.c')
-rw-r--r--CRT.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/CRT.c b/CRT.c
index 3c062919..50f0c0e8 100644
--- a/CRT.c
+++ b/CRT.c
@@ -19,6 +19,7 @@ in the source distribution for its full text.
#include <string.h>
#include <unistd.h>
+#include "CommandLine.h"
#include "ProvideCurses.h"
#include "XUtils.h"
@@ -1153,10 +1154,11 @@ void CRT_handleSIGSEGV(int signal) {
"============================\n"
"Please check at https://htop.dev/issues whether this issue has already been reported.\n"
"If no similar issue has been reported before, please create a new issue with the following information:\n"
- " - Your "PACKAGE" version: '"VERSION"'\n"
+ " - Your %s version: '"VERSION"'\n"
" - Your OS and kernel version (uname -a)\n"
" - Your distribution and release (lsb_release -a)\n"
- " - Likely steps to reproduce (How did it happen?)\n"
+ " - Likely steps to reproduce (How did it happen?)\n",
+ program
);
#ifdef PRINT_BACKTRACE
@@ -1196,15 +1198,16 @@ void CRT_handleSIGSEGV(int signal) {
fprintf(stderr,
"\n"
"To make the above information more practical to work with, "
- "please also provide a disassembly of your "PACKAGE" binary. "
+ "please also provide a disassembly of your %s binary. "
"This can usually be done by running the following command:\n"
- "\n"
+ "\n",
+ program
);
#ifdef HTOP_DARWIN
- fprintf(stderr, " otool -tvV `which "PACKAGE"` > ~/htop.otool\n");
+ fprintf(stderr, " otool -tvV `which %s` > ~/%s.otool\n", program, program);
#else
- fprintf(stderr, " objdump -d -S -w `which "PACKAGE"` > ~/htop.objdump\n");
+ fprintf(stderr, " objdump -d -S -w `which %s` > ~/%s.objdump\n", program, program);
#endif
fprintf(stderr,
@@ -1216,8 +1219,9 @@ void CRT_handleSIGSEGV(int signal) {
fprintf(stderr,
"Running this program with debug symbols or inside a debugger may provide further insights.\n"
"\n"
- "Thank you for helping to improve "PACKAGE"!\n"
- "\n"
+ "Thank you for helping to improve %s!\n"
+ "\n",
+ program
);
/* Call old sigsegv handler; may be default exit or third party one (e.g. ASAN) */

© 2014-2024 Faster IT GmbH | imprint | privacy policy