Put GDB's terminal settings into effect when paginating
[deliverable/binutils-gdb.git] / gdb / fbsd-nat.c
index a2a1f60ec4b4a2f3c1a2e09199182f7beeb93bf2..4e115b276f8af519dfca7acb39947f7b3530c37c 100644 (file)
@@ -39,9 +39,9 @@
 char *
 fbsd_pid_to_exec_file (struct target_ops *self, int pid)
 {
-  size_t len = PATH_MAX;
-  char *buf = xcalloc (len, sizeof (char));
-  char *path;
+  ssize_t len = PATH_MAX;
+  static char buf[PATH_MAX];
+  char name[PATH_MAX];
 
 #ifdef KERN_PROC_PATHNAME
   int mib[4];
@@ -54,15 +54,15 @@ fbsd_pid_to_exec_file (struct target_ops *self, int pid)
     return buf;
 #endif
 
-  path = xstrprintf ("/proc/%d/file", pid);
-  if (readlink (path, buf, PATH_MAX - 1) == -1)
+  xsnprintf (name, PATH_MAX, "/proc/%d/exe", pid);
+  len = readlink (name, buf, PATH_MAX - 1);
+  if (len != -1)
     {
-      xfree (buf);
-      buf = NULL;
+      buf[len] = '\0';
+      return buf;
     }
 
-  xfree (path);
-  return buf;
+  return NULL;
 }
 
 static int
@@ -214,6 +214,5 @@ fbsd_make_corefile_notes (struct target_ops *self, bfd *obfd, int *note_size)
                                          fname, psargs);
     }
 
-  make_cleanup (xfree, note_data);
   return note_data;
 }
This page took 0.024039 seconds and 4 git commands to generate.