Merge branch 'maint-0.2.7'

This commit is contained in:
Nick Mathewson 2015-12-15 11:55:46 -05:00
commit fec5aa75f4
4 changed files with 13 additions and 10 deletions

3
changes/bug17827 Normal file
View File

@ -0,0 +1,3 @@
o Minor bugfixes (compilation):
- Fix backtrace compilation on FreeBSD. Fixes bug 17827; bugfix on
tor-0.2.5.2-alpha.

View File

@ -62,16 +62,16 @@ static tor_mutex_t cb_buf_mutex;
* ucontext_t structure. * ucontext_t structure.
*/ */
void void
clean_backtrace(void **stack, int depth, const ucontext_t *ctx) clean_backtrace(void **stack, size_t depth, const ucontext_t *ctx)
{ {
#ifdef PC_FROM_UCONTEXT #ifdef PC_FROM_UCONTEXT
#if defined(__linux__) #if defined(__linux__)
const int n = 1; const size_t n = 1;
#elif defined(__darwin__) || defined(__APPLE__) || defined(__OpenBSD__) \ #elif defined(__darwin__) || defined(__APPLE__) || defined(__OpenBSD__) \
|| defined(__FreeBSD__) || defined(__FreeBSD__)
const int n = 2; const size_t n = 2;
#else #else
const int n = 1; const size_t n = 1;
#endif #endif
if (depth <= n) if (depth <= n)
return; return;
@ -89,9 +89,9 @@ clean_backtrace(void **stack, int depth, const ucontext_t *ctx)
void void
log_backtrace(int severity, int domain, const char *msg) log_backtrace(int severity, int domain, const char *msg)
{ {
int depth; size_t depth;
char **symbols; char **symbols;
int i; size_t i;
tor_mutex_acquire(&cb_buf_mutex); tor_mutex_acquire(&cb_buf_mutex);
@ -120,7 +120,7 @@ static void
crash_handler(int sig, siginfo_t *si, void *ctx_) crash_handler(int sig, siginfo_t *si, void *ctx_)
{ {
char buf[40]; char buf[40];
int depth; size_t depth;
ucontext_t *ctx = (ucontext_t *) ctx_; ucontext_t *ctx = (ucontext_t *) ctx_;
int n_fds, i; int n_fds, i;
const int *fds = NULL; const int *fds = NULL;
@ -174,7 +174,7 @@ install_bt_handler(void)
* libc has pre-loaded the symbols we need to dump things, so that later * libc has pre-loaded the symbols we need to dump things, so that later
* reads won't be denied by the sandbox code */ * reads won't be denied by the sandbox code */
char **symbols; char **symbols;
int depth = backtrace(cb_buf, MAX_DEPTH); size_t depth = backtrace(cb_buf, MAX_DEPTH);
symbols = backtrace_symbols(cb_buf, depth); symbols = backtrace_symbols(cb_buf, depth);
if (symbols) if (symbols)
free(symbols); free(symbols);

View File

@ -13,7 +13,7 @@ void clean_up_backtrace_handler(void);
#ifdef EXPOSE_CLEAN_BACKTRACE #ifdef EXPOSE_CLEAN_BACKTRACE
#if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && \ #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && \
defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_SIGACTION) defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_SIGACTION)
void clean_backtrace(void **stack, int depth, const ucontext_t *ctx); void clean_backtrace(void **stack, size_t depth, const ucontext_t *ctx);
#endif #endif
#endif #endif

View File

@ -1602,7 +1602,7 @@ sigsys_debugging(int nr, siginfo_t *info, void *void_context)
const char *syscall_name; const char *syscall_name;
int syscall; int syscall;
#ifdef USE_BACKTRACE #ifdef USE_BACKTRACE
int depth; size_t depth;
int n_fds, i; int n_fds, i;
const int *fds = NULL; const int *fds = NULL;
#endif #endif