Skip to content

Commit 4b83ca7

Browse files
committed
Do not call non-reentrant functions from signal handler.
1 parent 681a654 commit 4b83ca7

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/gridftp_hdfs.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,13 @@ GlobusExtensionDefineModule(globus_gridftp_server_hdfs) =
9696
void
9797
segv_handler (int sig)
9898
{
99-
printf ("SEGV triggered in native code.\n");
99+
write(1, "SEGV triggered in native code.\n", 31);
100100
const int max_trace = 32;
101101
void *trace[max_trace];
102-
char **messages = (char **)NULL;
103102
int i, trace_size = 0;
104103

105104
trace_size = backtrace(trace, max_trace);
106-
messages = backtrace_symbols(trace, trace_size);
107-
for (i=0; i<trace_size; ++i) {
108-
printf("[bt] %s\n", messages[i]);
109-
}
105+
backtrace_symbols_fd(trace, trace_size, 1);
110106
raise (SIGQUIT);
111107
signal (SIGSEGV, SIG_DFL);
112108
raise (SIGSEGV);

0 commit comments

Comments
 (0)