aboutsummaryrefslogtreecommitdiff
path: root/gdb/windows-nat.c
diff options
context:
space:
mode:
authorPierre Muller <muller@sourceware.org>2012-11-13 09:46:11 +0000
committerPierre Muller <muller@sourceware.org>2012-11-13 09:46:11 +0000
commit08850b56edd752c3792bfb9bfc59dd9a5577ac2d (patch)
treedc5581a48e546d35ecdbb5a832c0a83185cb585e /gdb/windows-nat.c
parentcec6a5b82ba19f3d8155503da6d7313c9321fcf6 (diff)
downloadgdb-08850b56edd752c3792bfb9bfc59dd9a5577ac2d.zip
gdb-08850b56edd752c3792bfb9bfc59dd9a5577ac2d.tar.gz
gdb-08850b56edd752c3792bfb9bfc59dd9a5577ac2d.tar.bz2
ARI fixes: Avoid sprintf function use rule.
* charset.c (convert_between_encodings): Use xsnprintf. * cli-out.c (cli_field_int): Likewise. * cp-namespace.c (cp_lookup_nested_symbol): Likewise. * expprint.c (op_name_standard): Likewise. * frv-tdep.c (set_variant_num_gprs): Likewise. (set_variant_num_fprs): Likewise. * m68hc11-tdep.c (m68hc11_initialize_register_info): Likewise. * nto-tdep.c (nto_find_and_open_solib): Likewise. (nto_init_solib_absolute_prefix): Likewise. * source.c (init_source_path): Likewise. (print_source_lines_base): Likewise. * valprint.c (print_wchar): Likewise. * mi/mi-out.c (mi_field_int): Likewise. windows-nat.c (windows_pid_to_exec_file): Likewise. (windows_create_inferior): Likewise. (_initialize_check_for_gdb_ini): Likewise.
Diffstat (limited to 'gdb/windows-nat.c')
-rw-r--r--gdb/windows-nat.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index a8766cd..75831d8 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1895,7 +1895,8 @@ windows_pid_to_exec_file (int pid)
/* Try to find exe name as symlink target of /proc/<pid>/exe. */
int nchars;
char procexe[sizeof ("/proc/4294967295/exe")];
- sprintf (procexe, "/proc/%u/exe", pid);
+
+ xsnprintf (procexe, sizeof (procexe), "/proc/%u/exe", pid);
nchars = readlink (procexe, path, sizeof(path));
if (nchars > 0 && nchars < sizeof (path))
{
@@ -2093,10 +2094,10 @@ windows_create_inferior (struct target_ops *ops, char *exec_file,
cygallargs = (wchar_t *) alloca (len * sizeof (wchar_t));
swprintf (cygallargs, len, L" -c 'exec %s %s'", exec_file, allargs);
#else
- cygallargs = (char *)
- alloca (sizeof (" -c 'exec '") + strlen (exec_file)
- + strlen (allargs) + 2);
- sprintf (cygallargs, " -c 'exec %s %s'", exec_file, allargs);
+ len = (sizeof (" -c 'exec '") + strlen (exec_file)
+ + strlen (allargs) + 2);
+ cygallargs = (char *) alloca (len);
+ xsnprintf (cygallargs, len, " -c 'exec %s %s'", exec_file, allargs);
#endif
toexec = shell;
flags |= DEBUG_PROCESS;
@@ -2724,8 +2725,9 @@ _initialize_check_for_gdb_ini (void)
{
int len = strlen (oldini);
char *newini = alloca (len + 1);
- sprintf (newini, "%.*s.gdbinit",
- (int) (len - (sizeof ("gdb.ini") - 1)), oldini);
+
+ xsnprintf (newini, len + 1, "%.*s.gdbinit",
+ (int) (len - (sizeof ("gdb.ini") - 1)), oldini);
warning (_("obsolete '%s' found. Rename to '%s'."), oldini, newini);
}
}