summaryrefslogtreecommitdiff
path: root/libgfortran/runtime
diff options
context:
space:
mode:
authorro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-15 10:26:16 +0000
committerro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-15 10:26:16 +0000
commit8fc4a5433fdc93486671ef859de8ef59e678bf83 (patch)
tree0c6cb0f4b991ad4fab2084303320d9c92e13ced0 /libgfortran/runtime
parentafbbeaf79b29c1482ead3816c38733e8a1ec5215 (diff)
downloadgcc-8fc4a5433fdc93486671ef859de8ef59e678bf83.tar.gz
PR libfortran/32345
* runtime/backtrace.c (show_backtrace): Only use snprintf if available. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125739 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/runtime')
-rw-r--r--libgfortran/runtime/backtrace.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libgfortran/runtime/backtrace.c b/libgfortran/runtime/backtrace.c
index 3b17a3950bf..3577c6476a6 100644
--- a/libgfortran/runtime/backtrace.c
+++ b/libgfortran/runtime/backtrace.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2006, 2007 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert
This file is part of the GNU Fortran 95 runtime library (libgfortran).
@@ -301,7 +301,11 @@ fallback:
st_printf ("\nBacktrace for this error:\n");
arg[0] = (char *) "pstack";
+#ifdef HAVE_SNPRINTF
snprintf (buf, sizeof(buf), "%d", (int) getppid ());
+#else
+ sprintf (buf, "%d", (int) getppid ());
+#endif
arg[1] = buf;
arg[2] = NULL;
execvp (arg[0], arg);