From 5fff8fc01dcfdbf50de4219fddd623a1f5987399 Mon Sep 17 00:00:00 2001
From: Mark Kettenis <kettenis@gnu.org>
Date: Mon, 18 Jul 2005 21:00:50 +0000
Subject: [PATCH] * target.c (normal_pid_to_str): Use xsnprintf instead of
 snprintf. * bsd-uthread.c (bsd_uthread_pid_to_str): Likewise. * inf-ttrace.c
 (inf_ttrace_pid_to_str): Likewise.

---
 gdb/ChangeLog     | 4 ++++
 gdb/bsd-uthread.c | 6 ++----
 gdb/inf-ttrace.c  | 6 ++----
 gdb/target.c      | 4 +---
 4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 129e2e1fec7..2baa7562748 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2005-07-18  Mark Kettenis  <kettenis@gnu.org>
 
+	* target.c (normal_pid_to_str): Use xsnprintf instead of snprintf.
+	* bsd-uthread.c (bsd_uthread_pid_to_str): Likewise.
+	* inf-ttrace.c (inf_ttrace_pid_to_str): Likewise.
+
 	* hppa-tdep.h (hppa_frame_prev_register_helper): Change types of
 	last argument to `gdb_byte *'.
 	* hppa-tdep.c (hppa32_convert_from_func_ptr_addr): Rewrite.
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index aa3425d73f9..9004b408473 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -469,11 +469,9 @@ bsd_uthread_pid_to_str (ptid_t ptid)
   if (ptid_get_tid (ptid) != 0)
     {
       static char buf[64];
-      int size;
 
-      size = snprintf (buf, sizeof buf, "process %d, thread 0x%lx",
-		       ptid_get_pid (ptid), ptid_get_tid (ptid));
-      gdb_assert (size < sizeof buf);
+      xsnprintf (buf, sizeof buf, "process %d, thread 0x%lx",
+		 ptid_get_pid (ptid), ptid_get_tid (ptid));
       return buf;
     }
 
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index 6b20be695ec..e83b478223c 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -909,11 +909,9 @@ inf_ttrace_pid_to_str (ptid_t ptid)
       pid_t pid = ptid_get_pid (ptid);
       lwpid_t lwpid = ptid_get_lwp (ptid);
       static char buf[128];
-      int size;
 
-      size = snprintf (buf, sizeof buf, "process %ld, lwp %ld",
-		       (long)pid, (long)lwpid);
-      gdb_assert (size < sizeof buf);
+      xsnprintf (buf, sizeof buf, "process %ld, lwp %ld",
+		 (long)pid, (long)lwpid);
       return buf;
     }
 
diff --git a/gdb/target.c b/gdb/target.c
index dfe942775c9..83501e60961 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1793,10 +1793,8 @@ char *
 normal_pid_to_str (ptid_t ptid)
 {
   static char buf[32];
-  int size;
 
-  size = snprintf (buf, sizeof buf, "process %d", ptid_get_pid (ptid));
-  gdb_assert (size < sizeof buf);
+  xsnprintf (buf, sizeof buf, "process %d", ptid_get_pid (ptid));
   return buf;
 }