aboutsummaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
Diffstat (limited to 'manual')
-rw-r--r--manual/examples/execinfo.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/manual/examples/execinfo.c b/manual/examples/execinfo.c
index a789b6b5a7..3cedf7f35f 100644
--- a/manual/examples/execinfo.c
+++ b/manual/examples/execinfo.c
@@ -24,17 +24,18 @@ void
print_trace (void)
{
void *array[10];
- size_t size;
char **strings;
- size_t i;
+ int size, i;
size = backtrace (array, 10);
strings = backtrace_symbols (array, size);
+ if (strings != NULL)
+ {
- printf ("Obtained %zd stack frames.\n", size);
-
- for (i = 0; i < size; i++)
- printf ("%s\n", strings[i]);
+ printf ("Obtained %d stack frames.\n", size);
+ for (i = 0; i < size; i++)
+ printf ("%s\n", strings[i]);
+ }
free (strings);
}