Skip to content

Commit 257cd6e

Browse files
committed
show a line after stack trace as a checksum
1 parent f1e5953 commit 257cd6e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

jsrc/jconsole.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,18 @@ static int err_write(void *data, uintptr_t pc, const char *file, int line, const
4242
file = file ? file : "?";
4343
while(!strncmp(file, "../", 3)) file += 3; // strip leading '../'. Don't strip leading 'jsrc/' to avoid ambiguity with source files with other origins.
4444
snprintf(buf, sizeof(buf), "%0*lx: %s:%d:\t%s\n", BW==64?16:8, (unsigned long)pc, file, line, function ? function : "?");
45-
ssize_t r=write(STDERR_FILENO, buf, strlen(buf));
45+
(void)!write(STDERR_FILENO, buf, strlen(buf));
4646
R 0;}
4747
static void sigsegv(int k){
4848
//todo should say to report to the beta forums for beta builds
4949
const char msg[] = "JE has crashed, likely due to an internal bug. Please report the code which caused the crash, as well as the following printout, to the J programming forum.\n";
5050
// write is async-signal safe; fwrite&co are not, but still do this, just to be safe
5151
// similarly, can't fflush(stderr) first; too bad
52-
ssize_t r=write(STDERR_FILENO, msg, sizeof(msg)-1);
52+
(void)!write(STDERR_FILENO, msg, sizeof(msg)-1);
5353
struct backtrace_state *state = backtrace_create_state(NULL, 1, NULL, NULL);
5454
backtrace_full(state, 0, err_write, NULL, NULL);
55+
const char line[] = "-----------------------------------------------------------------------------\n";
56+
(void)!write(STDERR_FILENO, line, 78);
5557
fsync(STDERR_FILENO);
5658
//abort rather than exit to ensure a core dump is still generated
5759
abort();}

0 commit comments

Comments
 (0)