#ifdef HAVE_EXECINFO_H
# define MAX_BT_FRAMES 128
-# define MAX_BT_ENTRIES 65536 //!< Should be a power of 2
+# define MAX_BT_CBUFF 65536 //!< Should be a power of 2
# ifdef HAVE_PTHREAD_H
static pthread_mutex_t fr_debug_init = PTHREAD_MUTEX_INITIALIZER;
fprintf(stderr, "Stacktrace for: %p\n", p);
for (i = 0; i < p->count; i++) {
- fprintf(stdout, "%s\n", frames[i]);
+ fprintf(stderr, "%s\n", frames[i]);
}
/* We were only asked to look for one */
TALLOC_CTX *ctx;
ctx = fr_autofree_ctx();
- *cbuff = fr_cbuff_alloc(ctx, MAX_BT_ENTRIES, true);
+ *cbuff = fr_cbuff_alloc(ctx, MAX_BT_CBUFF, true);
}
PTHREAD_MUTEX_UNLOCK(&fr_debug_init);
}
#else
void backtrace_print(UNUSED fr_cbuff_t *cbuff, UNUSED void *obj)
{
- fr_perror("Server built without fr_backtrace_* support, requires execinfo.h and possibly -lexecinfo");
+ fprintf(stderr, "Server built without fr_backtrace_* support, requires execinfo.h and possibly -lexecinfo\n");
}
fr_bt_marker_t *fr_backtrace_attach(UNUSED fr_cbuff_t **cbuff, UNUSED TALLOC_CTX *obj)
{
- fr_perror("Server built without fr_backtrace_* support, requires execinfo.h and possibly -lexecinfo");
+ fprintf(stderr, "Server built without fr_backtrace_* support, requires execinfo.h and possibly -lexecinfo\n");
abort();
}
#endif /* ifdef HAVE_EXECINFO_H */
bool fr_assert_cond(char const *file, int line, char const *expr, bool cond)
{
if (!cond) {
- fr_perror("SOFT ASSERT FAILED %s[%u]: %s", file, line, expr);
+ fr_perror("SOFT ASSERT FAILED %s[%u]: %s: ", file, line, expr);
return false;
}
void NEVER_RETURNS _fr_exit(char const *file, int line, int status)
{
#ifndef NDEBUG
- fr_perror("EXIT CALLED %s[%u]: %i", file, line, status);
+ fr_perror("EXIT CALLED %s[%u]: %i: ", file, line, status);
#endif
fflush(stderr);
void NEVER_RETURNS _fr_exit_now(char const *file, int line, int status)
{
#ifndef NDEBUG
- fr_perror("_EXIT CALLED %s[%u]: %i", file, line, status);
+ fr_perror("_EXIT CALLED %s[%u]: %i: ", file, line, status);
#endif
fflush(stderr);
{
WSADATA wsaData;
if (WSAStartup(MAKEWORD(2, 0), &wsaData)) {
- fprintf(stderr, "%s: Unable to initialize socket library.\n", progname);
- return 1;
+ fprintf(stderr, "%s: Unable to initialize socket library.\n", progname);
+ exit(EXIT_FAILURE);
}
}
#endif