Use a separate variable for the size passed to sysctl.
authorJohn Baldwin <jhb@FreeBSD.org>
Tue, 19 Jan 2016 18:23:00 +0000 (10:23 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Tue, 19 Jan 2016 19:35:19 +0000 (11:35 -0800)
This fixes a sign mismatch warning.

gdb/ChangeLog:

* fbsd-nat.c (fbsd_pid_to_exec_file): Use new "buflen" instead of
"len" with sysctl.

gdb/ChangeLog
gdb/fbsd-nat.c

index e8277f3..6a77fdd 100644 (file)
@@ -1,5 +1,10 @@
 2016-01-19  John Baldwin  <jhb@FreeBSD.org>
 
+       * fbsd-nat.c (fbsd_pid_to_exec_file): Use new "buflen" instead of
+       "len" with sysctl.
+
+2016-01-19  John Baldwin  <jhb@FreeBSD.org>
+
        * fbsd-tdep.c (find_stop_signal): Remove.
        (struct fbsd_collect_regset_section_cb) <lwp>: New field.
        <stop_signal>: New field.
index d2ec527..e7ca0e6 100644 (file)
 static char *
 fbsd_pid_to_exec_file (struct target_ops *self, int pid)
 {
-  ssize_t len = PATH_MAX;
+  ssize_t len;
   static char buf[PATH_MAX];
   char name[PATH_MAX];
 
 #ifdef KERN_PROC_PATHNAME
+  size_t buflen;
   int mib[4];
 
   mib[0] = CTL_KERN;
   mib[1] = KERN_PROC;
   mib[2] = KERN_PROC_PATHNAME;
   mib[3] = pid;
-  if (sysctl (mib, 4, buf, &len, NULL, 0) == 0)
+  buflen = sizeof buf;
+  if (sysctl (mib, 4, buf, &buflen, NULL, 0) == 0)
     return buf;
 #endif