Avoid PATH_MAX usage
authorThomas Schwinge <thomas@codesourcery.com>
Thu, 8 Dec 2016 17:42:03 +0000 (18:42 +0100)
committerThomas Schwinge <thomas@codesourcery.com>
Fri, 9 Dec 2016 06:19:28 +0000 (07:19 +0100)
On GNU/Hurd, there is no "#define PATH_MAX", so this failed to build.

gdb/
* inferior.c (print_selected_inferior): Avoid PATH_MAX usage.

gdb/ChangeLog
gdb/inferior.c

index 2bd99f158e5053aa948f6e5f0510a77b88b67cfe..302eb6eaf401f8c8224aac048d71d95551d15bdc 100644 (file)
@@ -1,3 +1,7 @@
+2016-12-09  Thomas Schwinge  <thomas@codesourcery.com>
+
+       * inferior.c (print_selected_inferior): Avoid PATH_MAX usage.
+
 2016-12-08  Simon Marchi  <simon.marchi@ericsson.com>
            Thomas Schwinge  <thomas@codesourcery.com>
 
index 9fcdbd3b8303989ca429ff5e3d3a2b23943294d4..af6f3af3f7298d19dc53e02681a46880443fec91 100644 (file)
@@ -556,17 +556,12 @@ inferior_pid_to_str (int pid)
 void
 print_selected_inferior (struct ui_out *uiout)
 {
-  char buf[PATH_MAX + 256];
   struct inferior *inf = current_inferior ();
-
-  xsnprintf (buf, sizeof (buf),
-            _("[Switching to inferior %d [%s] (%s)]\n"),
-            inf->num,
-            inferior_pid_to_str (inf->pid),
-            (inf->pspace->pspace_exec_filename != NULL
-             ? inf->pspace->pspace_exec_filename
-             : _("<noexec>")));
-  ui_out_text (uiout, buf);
+  const char *filename = inf->pspace->pspace_exec_filename;
+  if (filename == NULL)
+    filename = _("<noexec>");
+  ui_out_message (uiout, _("[Switching to inferior %d [%s] (%s)]\n"),
+                 inf->num, inferior_pid_to_str (inf->pid), filename);
 }
 
 /* Prints the list of inferiors and their details on UIOUT.  This is a
This page took 0.033695 seconds and 4 git commands to generate.