sprintf.
* target.c (normal_pid_to_str): Likewise.
* remote.c (remote_pid_to_str): Use snprint instead of sprintf.
Change capitalization of "thread". Use ptid_get_pid instead of
GETPID.
-2005-03-13 Mark Kettenis <kettenis@gnu.org>
+2005-03-13 Mark Kettenis <kettenis@elgar.gnu.org>
+
+ * inf-ttrace.c (inf_ttrace_pid_to_str): Use snprintf instead of
+ sprintf.
+ * target.c (normal_pid_to_str): Likewise.
+ * remote.c (remote_pid_to_str): Use snprint instead of sprintf.
+ Change capitalization of "thread". Use ptid_get_pid instead of
+ GETPID.
* cp-abi.c (set_cp_abi_as_auto_default): Use xasprintf instead of
a combination of xmalloc and sprintf.
{
pid_t pid = ptid_get_pid (ptid);
lwpid_t lwpid = ptid_get_lwp (ptid);
- static char buf[80];
+ static char buf[128];
+ int size;
- sprintf (buf, "process %ld, lwp %ld", (long)pid, (long)lwpid);
+ size = snprintf (buf, sizeof buf, "process %ld, lwp %ld",
+ (long)pid, (long)lwpid);
+ gdb_assert (size < sizeof buf);
return buf;
}
static char *
remote_pid_to_str (ptid_t ptid)
{
- static char buf[30];
+ static char buf[32];
+ int size;
- sprintf (buf, "Thread %d", PIDGET (ptid));
+ size = snprintf (buf, sizeof buf, "thread %d", ptid_get_pid (ptid));
+ gdb_assert (size < sizeof buf);
return buf;
}
int (*target_activity_function) (void);
int target_activity_fd;
\f
-/* Convert a normal process ID to a string. Returns the string in a static
- buffer. */
+/* Convert a normal process ID to a string. Returns the string in a
+ static buffer. */
char *
normal_pid_to_str (ptid_t ptid)
{
- static char buf[30];
+ static char buf[32];
+ int size;
- sprintf (buf, "process %d", PIDGET (ptid));
+ size = snprintf (buf, sizeof buf, "process %d", ptid_get_pid (ptid));
+ gdb_assert (size < sizeof buf);
return buf;
}