4 #ifdef BACKTRACE_SUPPORT
23 attr->
size =
sizeof(*attr);
35 if (
stat(path, &st) == 0)
40 while ((d =
strchr(d,
'/'))) {
42 err =
stat(path, &st) && mkdir(path, mode);
49 return (
stat(path, &st) && mkdir(path, mode)) ? -1 : 0;
52 static int slow_copyfile(
const char *
from,
const char *to)
57 FILE *from_fp = fopen(from,
"r"), *to_fp;
62 to_fp = fopen(to,
"w");
66 while (getline(&line, &n, from_fp) > 0)
67 if (fputs(line, to_fp) ==
EOF)
90 return slow_copyfile(from, to);
96 tofd = creat(to, 0755);
101 if (addr == MAP_FAILED)
142 void *buf_start =
buf;
154 return buf - buf_start;
168 #ifdef BACKTRACE_SUPPORT
173 char **strings = backtrace_symbols(array, size);
176 printf(
"Obtained %zd stack frames.\n", size);
178 for (i = 0; i <
size; i++)
179 printf(
"%s\n", strings[i]);