diff options
author | Neal H. Walfield <neal@gnu.org> | 2009-02-23 03:43:41 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@gnu.org> | 2009-02-23 03:43:41 +0100 |
commit | 0c44705f8ba6f931edbee9e2b11e9057bbc9f2e0 (patch) | |
tree | bb274556ed7dcbfd27da14a08728a57e4833e3cf | |
parent | 72081a0d9f6668345764b38b0e934cf0dbecb676 (diff) |
Don't include a backtrace if there is none to be had.
-rw-r--r-- | hurd/trace.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/hurd/trace.h b/hurd/trace.h index c566e9f..4b6ad89 100644 --- a/hurd/trace.h +++ b/hurd/trace.h @@ -109,15 +109,18 @@ trace_buffer_add (const char *func, const int lineno, buffer->count = backtrace (buffer->bt, (sizeof (buffer->bt) / sizeof (buffer->bt[0]))); - int i; - pc (' '); pc ('('); - for (i = 0; i < buffer->count; i ++) + if (buffer->count > 0) { - s_cprintf (pc, "%x", buffer->bt[i]); - if (i != buffer->count - 1) - pc (' '); + int i; + pc (' '); pc ('('); + for (i = 0; i < buffer->count; i ++) + { + s_cprintf (pc, "%x", buffer->bt[i]); + if (i != buffer->count - 1) + pc (' '); + } + pc (')'); } - pc (')'); } /* And add a terminating NUL. */ |