summaryrefslogtreecommitdiffstats
path: root/libgfortran/runtime
diff options
context:
space:
mode:
authorjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-16 17:43:03 +0000
committerjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-16 17:43:03 +0000
commitd151c82cf60c5d1350012dd0e79546c5e5c3e2ca (patch)
treea18b46c3ac70b0e29558cbe228eaa2af23e758b9 /libgfortran/runtime
parent39ec41d495144d434782654e483b1adcb672f55e (diff)
downloadppe42-gcc-d151c82cf60c5d1350012dd0e79546c5e5c3e2ca.tar.gz
ppe42-gcc-d151c82cf60c5d1350012dd0e79546c5e5c3e2ca.zip
Replace sprintf with snprintf
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172590 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/runtime')
-rw-r--r--libgfortran/runtime/backtrace.c8
-rw-r--r--libgfortran/runtime/main.c10
2 files changed, 8 insertions, 10 deletions
diff --git a/libgfortran/runtime/backtrace.c b/libgfortran/runtime/backtrace.c
index 4a831c0d8b2..5e4f15c78c9 100644
--- a/libgfortran/runtime/backtrace.c
+++ b/libgfortran/runtime/backtrace.c
@@ -1,7 +1,7 @@
-/* Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2006, 2007, 2009, 2011 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -290,11 +290,7 @@ 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);
diff --git a/libgfortran/runtime/main.c b/libgfortran/runtime/main.c
index 28247ca878f..f5d4721283e 100644
--- a/libgfortran/runtime/main.c
+++ b/libgfortran/runtime/main.c
@@ -1,7 +1,8 @@
-/* Copyright (C) 2002-2003, 2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2003, 2005, 2007, 2009, 2011
+ Free Software Foundation, Inc.
Contributed by Andy Vaught and Paul Brook <paul@nowt.org>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -107,8 +108,9 @@ store_exe_path (const char * argv0)
#endif
/* exe_path will be cwd + "/" + argv[0] + "\0" */
- path = malloc (strlen (cwd) + 1 + strlen (argv0) + 1);
- sprintf (path, "%s%c%s", cwd, DIR_SEPARATOR, argv0);
+ size_t pathlen = strlen (cwd) + 1 + strlen (argv0) + 1;
+ path = malloc (pathlen);
+ snprintf (path, pathlen, "%s%c%s", cwd, DIR_SEPARATOR, argv0);
exe_path = path;
please_free_exe_path_when_done = 1;
}
OpenPOWER on IntegriCloud